Archive

Posts Tagged ‘Flash’

Call function from Flex to Flash

June 24th, 2009 2 comments

How to call a flash function from flex?

  1. Load the AS3 swf file using an instance of SWFLoader.
  2. Call the function like this:
mySWFLoader.content.functionName();

How to listen for flash events from flex?

  1. // In your Flex app
    /* called when your SWFLoader finishes loading the SWF */
    private function onMySWFLoaded( p_event:Event ) :void
    {
          mySWFLoader.content.addEventListener( “clicked”, onSWFClick );
    }

    /* callback for the clicked event */
    private function onSWFClick( event:Event ) :void
    {
          mx.controls.Alert.show( ‘Click event raised!’ );
    }

  2. // In Flash Movie
    /* called when the button in your flash movie is clicked */
    private function onButtonClick( p_event:Event ) :void
    {
          dispatchEvent( new Event( “clicked” );
    }

How to call a flex function from flash at a specific frame?

Embed(source=“../assets/swf/myFlashComponent.swf”, symbol=“Preloader”)]
private var FlashPreloaderSymbol:Class;
private var clip:MovieClip;

clip = new FlashPreloaderSymbol();
addChild(clip);

private function onFlexInitComplete( event:FlexEvent ):void
{
clip.addFrameScript(47, callMyFunction);
}



Flex Builder 4 Refactored to Flash Builder

June 6th, 2009 2 comments

The next version of our IDE, Flex Builder, will be called Flash Builder 4.

There is already available a public beta for Flash Builder 4 and Flash Catalyst (check Adobe Labs for downloads).

Mihai Corlan (Platform Evangelist for Adobe):
At the same time, we will not change the name of Flex Builder 3. This will stay as it is now. Furthermore, the names of the Flex framework, and the Flex SDK, remain unchanged. The same goes for Flash Professional, which remains unchanged.”
….
“This has happened to me more than once. When I ask people at conferences “Who’s a Flex developer?” many people are unsure how to answer. Why? Because some of you are using the Flex framework, to create Flex or AIR applications, and not our IDE (Flex Builder), some of you are using Flex Builder, but without using the Flex framework (you use ActionScript 3 to create Flash applications). Thus the uncertainty.

Of course, the correct answer is this: anyone who uses the Flex framework, is a Flex developer. It doesn’t matter what tools you use to create these applications. At the same time, any Flex application gets compiled into a SWF file, which is played by the Flash Player. The same happens with the applications written using ActionScript and not the Flex framework.

So looking at it from this perspective, I think it makes a lot of sense. Have the developer tool that is used for creating Flash/AIR applications with or without the Flex framework called Flash Builder 4.

Flex Builder 3 Flash Catalyst Flash Builder 4