• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

SWFLoader communication in both directions

Guest
Jun 18, 2010 Jun 18, 2010

Copy link to clipboard

Copied

Hi

I have a situation where I have a flash builder file that I use to store information to a database.

I also have a flash swf where I am colouring irregular shapes. I can send information to the flash file from the flashbuilder file using SWFLoader but I need to find what colours were chosen and which panels the colours were applied in the flash file so that I can store this information in the database from the flashbuilder file. From my reading of the subject, it would appear that SWFLoader only works in one direction.

Can anybody verify this and offer me an alternative method to receive information from the loaded swf file please.

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 02, 2010 Jul 02, 2010

Copy link to clipboard

Copied

LATEST

Hi,

If i had a function like this in my SWF(conveniently named mySWF.swf)

function getValue():String
{
    return "5";
}

And if the code on my flex app was like this.

            private var swfLdr:SWFLoader;
            private var childSwf:MovieClip;
            protected function application1_creationCompleteHandler(event:FlexEvent):void
            {
                // TODO Auto-generated method stub
                swfLdr = new SWFLoader();
                swfLdr.horizontalCenter = 0;
                swfLdr.verticalCenter = 0;
                swfLdr.source = "mySWF.swf";
                swfLdr.addEventListener(Event.COMPLETE, swfLoaded);
                swfLdr.load();

            }
            private function swfLoaded(event:Event):void{
                swfLdr.removeEventListener(Event.COMPLETE, swfLoaded);
               
                childSwf = new MovieClip();
                childSwf = event.target.content;
               
                var k=childSwf.getValue();
                trace(k);
               
            }

Then the value of k at the end of the SWFloaded function is "5". This does provide a form of the host SWF getting values from the loaded swf. Similarly, values can be passed as parameters to functions too. Pardon me if i misunderstood your query. Was this what u were looking for?

Nishad

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines