Posts Tagged fix

How to Make a SWFLoader Scroll

By default, the SWFLoader doesn’t scroll so developers often wrap it in a scrolling mx container like a Canvas (since it does scroll and it’s scroll policies are set to auto). What I didn’t think about was that I’d have to know the actual size of the content I was loading in order for the scrollbars to appear. I tested this in both an MX Application and a Spark Application with Flex SDK 4.5 and achieved the same results.

To reiterate, my small test app below suggests that developers must know the size of the content they are loading in SWFLoader in order for the scrollbars to appear around that loaded content.

When I think about it, it makes sense…at the same time it caught me by surprise when I first implemented it in an app. Hoping this piece of info helps developers loading legacy or 3rd party SWFs they don’t have control over.

<?xml version="1.0" encoding="utf-8"?>
<s:Application
	xmlns:fx="http://ns.adobe.com/mxml/2009"
	xmlns:s="library://ns.adobe.com/flex/spark"
	xmlns:mx="library://ns.adobe.com/flex/mx"
	minWidth="0"
	minHeight="0"
	creationComplete="init(event)"
	backgroundColor="#FF0000"
	>

	<fx:Script>
		<![CDATA[
			import mx.containers.Canvas;
			import mx.controls.SWFLoader;
			import mx.events.FlexEvent;

			protected function init(event:FlexEvent):void
			{
				var swfLoaderContainer:Canvas = new Canvas();
				swfLoaderContainer.percentWidth = 100;
				swfLoaderContainer.percentHeight = 100;
				this.addElement(swfLoaderContainer);

				var swfLoader:SWFLoader = new SWFLoader();
				swfLoader.width = 1200; // does not add scroll bar
				swfLoader.height = 800; // does not add scroll bar
//				swfLoader.percentWidth = 100; // DOES NOT add scroll bar
//				swfLoader.percentHeight = 100; // DOES NOT add scroll bar
				swfLoader.scaleContent = false;
				swfLoaderContainer.addElement(swfLoader);

				var context:LoaderContext = new LoaderContext(false, new ApplicationDomain());
				swfLoader.loaderContext = context;
				swfLoader.load("SWFToLoad.swf");
			}

		]]>
	</fx:Script>

</s:Application>

Post to Twitter Tweet This Post

, , , ,

No Comments

Mac Flash Builder Plugin Install Error 6 + FIX

I just received my new 17in MBP so I pulled down a new version of Eclipse’s J2EE IDE and installed Flash Builder Plugin.

NOTE: You need to use the Eclipse Galileo Packages and the Carbon Install in order for this to work since FB is not compatible with the latets Eclipse build called Helio — here’s a link to the exact version of Eclipse that I used.

After a seemingly successful installation I received the following error code when starting up Eclipse: Error 6. I googled around a bit and found this link with this important tid-bit that fixed my issue:

  • Reboot your Mac
  • Navigate to your installation folder under /Adobe Flash Builder 4 Plug-in/install.support/AdobeFlashBuilderPluginSTIWrapperMac/
  • Run Install.app from that location, to make sure all the required runtimes are installed successfully.

The restart seemed to do nothing, but running the installer did the trick. Good luck!

Post to Twitter Tweet This Post

, , , , ,

No Comments

Workaround to Flex SDK 3.4 Bug 22333 :: HTTPService Responders Are Called Twice…Here’s a Fix!

This one kicked my team’s ass for a couple of hours so I’m hoping it’ll help somone else…so we updated our Flex SDKs to 3.4 and all of a sudden all of our Delegates’ result handlers were getting called twice. We thought it was due to our service orchestration object (we have a base object that allows us to make sequential Cairngorm service calls) and somehow we were calling the services 2x, but nope…wasn’t it. Seemed our AbstractDelegate that sets up the responders for all of our service calls like so had the issue:

public function executeHTTPService(requestDTO:AbstractRequestDTO=null):void
{
	logger.debug("executeHTTPService");

	var token:AsyncToken;
	var responder:mx.rpc.Responder;

	// create a responder for the service
	responder = new mx.rpc.Responder(result, fault); // WTF mate?

	// execute the service
	token = this.service.send(requestDTO);
	token.addResponder(responder); // why yall busted up now???
}

Apparently, SDK 3.4 reintroduces an old defect that causes this implementation of setting up the responder with the async token to call the result handler twice…bummer, eh? So what to do…well, a simple workaround until they fix this is to do the following:

this.service.addEventListener(ResultEvent.RESULT, result);
this.service.addEventListener(FaultEvent.FAULT, fault);

Just create your handlers with good-ole fashioned event handlers…DONE.

Get more info on the defect here.

Post to Twitter Tweet This Post

, , , , ,

3 Comments