Mark,

I have had success making calls to my AS3 SWFs  compiled in Flash
using the Flash
Professional 9 ActionScript 3.0
Preview<http://labs.adobe.com/technologies/flash9as3preview/>
.

The "Flash Professional 9 ActionScript 3.0 Preview" has been public for over
8 months.  I say shame on Adobe for publishing nothing on how to integrate
Flash authored AS3 SWFs into Flex 2 apps.  Nothing.

But huge thanks to Jesse Warden.  If you have not already, please review the
following 2 posts by Jesse on the topic.  Note:  the first link includes
downloadable code.  It has been a few weeks since I was in either Jesse or
my code.  I do recall that in the first article Jesse documented a few
requirements that I had not seen elsewhere and likely never would have
guessed.

Flash 9 Button in Flex 2, August 27, 2006
http://www.jessewarden.com/archives/2006/08/flash_9_button.html

Integrating a Flash Interface into Flex 2, December 17, 2006
http://www.jessewarden.com/archives/2006/12/integrating_a_f.html

If you are still unable to accomplish what you need to after reviewing
Jesse's posts, please post back and I will go into the code and see if I can
provide you a walkthrough.

Of course, please also post back if you do succeed in getting your Flash
authored AS3 SWFs working in Flex 2.

            hth,

            g

On 3/3/07, Mark <[EMAIL PROTECTED]> wrote:

I'm trying to load a flash 9 SWF into Flex with some luck.  I can
get it in there with SWFLoader but now how can I use something from
the Flash Library… or can I?

I get this error when I run the code below "ReferenceError: Error
#1065: Variable Radar is not defined."  But when I "Dismiss All"
then click the button in the app it will move the radar movieClip
that sits on the Flash Stage.  I'm confused as to what this error is.

For the library item - If it was being done in Flash, I'd use
attachMovie () like:

var cPoint:MovieClip = circle.attachMovie(pointer, 'point' +
counter, 0 + counter, {_x:centerX + x, _y:centerY + y, date:cDate});

which would place the item on the stage as many times as I need it
depending on the number of nodes from my XML.  Is there a way to do
this in Flex using my loaded SWF?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="init(event)">
<mx:Script>
        <![CDATA[
                import flash.events.*;
                import flash.net.URLRequest;
                import mx.controls.SWFLoader;
                import mx.utils.ObjectUtil;
                [Bindable]
                private var loaded:Boolean = false;
                private var swfContent:MovieClip;
                private var myLoader:SWFLoader = new SWFLoader();

                private function init(e:Event):void{
            myLoader.showBusyCursor = true;
            myLoader.addEventListener
(Event.INIT,loadHandler);
            this.addChild(myLoader);
            myLoader.y = 25;
            myLoader.x = 25;
            myLoader.load("Flash/radarFlexNoScript.swf");
        }
                private function loadHandler(e:Event):void{
            loaded = true;
            swfContent = e.target.content;
        }

                private function setRadar ():void {
                        //swfContent.getChildByName('radar').x = 0;
                        swfContent.radar.y += 20;
                        //swfContent.addChild('myPoint');
                }


        ]]>
</mx:Script>
<mx:Button click="setRadar()" label="Set Something" />
</mx:Application>

Reply via email to