Communicating with Embedded AS3 swfs in Flex app
Working on a project today trying to work between two different embedded swfs in a flex application. Actually one is in a dialog q d the other is in a module but same difference. So in the past we had worked with swf/flex communication with little difficulty. The swf in the module worked fine but the one in the dialog was throwing errors saying the function we were looking for wasn’t there. Grr.
After a bit of testing and troubleshooting I realized that though these files were being loaded into SWFLoaders, they were being loaded using different methods. The swf in the module was being added using the source property and a full URL. The swf I’m the dialog was being embedded from a local folder. Ah ha! All I needed to do was use a full URL for the dialogs swf – which was tricky – and voila! My swfs can communicate!
AS2 HtmlText Href listener
So a colleague of mine was working on an RSS reader that linked the title of the feed to the feed url. Problem was he was lumping all of the text into one htmltext field. This was fine until we realized we havefor something a colleague was working on we needed to be able to run a tracking script when a user clicked on an htmltext href link. After a fair amount of Googling, I found the answer here. As this was a truly glorious find, I named myself “Queen of the Mountain,” of course. Anywho, the code joshiverson so generously provides is this:
function myFunc(arg:String):void {
trace ("You clicked me!Argument was "+arg); } myTextField.htmlText ='<a href="asfunction:myFunc,Foo">Click Me!</a>';
By inserting the asfunction into the href and listing the function, you can call the function from within the html text. I thought that was sort of the coolest thing ever. You may ask why not just use AS3′s event listener (TextField.LINK) as joshiverson also describes. Well this is for a banner, which many Flash banner ad developers may know still requires us to use AS2 to meet publisher specs, which is a debate for another time. :/ For now I have stretching my google and problem solving skills!
Apr
23
- Continue Reading →
- Elizabeth Lattanzio
- No Comments
- Flash AS2
- Tags: flash as2

May
02