Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6209023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:54:37+00:00 2026-05-24T05:54:37+00:00

I’ve created a Flash Animation (CS5, ActionScript 3) and converted it to SWF. The

  • 0

I’ve created a Flash Animation (CS5, ActionScript 3) and converted it to SWF. The flash animation needs the values of 3 variables (defined in the swf timeline) BEFORE it starts running in my Flex application. I’ve embedded the swf file using swfloader in Flex, but I need to pass the parameters from Flex into Flash before the animation starts. How do I do this?

The way I have my flex code setup below, the variables are not being updated. I get an exception every time it gets to the changeParams function because it can’t find “Type”, “Num1”, etc.

Part of My flash code:

//These 3 variables need to be populated via Flex BEFORE the animation starts...
var Num2:int;
var Num1:int;
var Type:String;

var whichNumber:int;
var frameNumber:int;

function playMe():void {
switch (Type) {
    case 'type1':
        gotoAndPlay(16);
        break;
    case 'type2':
        frameNumber = 27;
        whichNumber = 1;
        gotoAndPlay(frameNumber);
        break;
    case 'type3':
        frameNumber = 29;
        whichNumber = 1;
        gotoAndPlay(17);
        break;
    case 'type4':
        whichNumber = 1;
        break;
}
}

My flex code:

        public function changeParams():void {
            idAnimation.content["Type"] = 'type1';
            idAnimation.content["Num1"] = 6;
            idAnimation.content["Num2"] = 30;
            trace ("Type= " + idAnimation.content["Type"]);
            trace ("Num1= " + idAnimation.content["Num1"]);
            trace ("Num2= " + idAnimation.content["Num2"]);
        }
    ]]>
</mx:Script>

<mx:SWFLoader id="idAnimation" source="animation.swf" init="changeParams()" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:54:37+00:00Added an answer on May 24, 2026 at 5:54 am

    Okay, so I found out what was wrong. As anemgyenge suggested, I changed my function to run at “complete” instead of “init”, but changeParams() never ran until I stopped trying to embed the swf to the swfloader. I guess I didn’t include that’s how I was doing it in my original post- my error. If you try to embed with @embed, it doesn’t run the “complete” event when you expect it to.

    The other thing I did was to add a “gotoAndPlay(1)” so it would play the first frame after the parameters were set. As anemgyenge suggested, I added stop() to the beginning of my Flash code so it doesn’t play until Flex tells it to. I use binding setters to run changeParams() any time one of my variables from Flex changes so the parameters will update in the Flash SWF and start the movie over at frame 1. So glad to finally have this figured out! 🙂

    Here’s my updated Flex code:

    public function changeParams():void {
          if (idAnimation.content != null) {
            idAnimation.content["Type"] = myString;
            idAnimation.content["Num1"] = myNum1;
            idAnimation.content["Num2"] = myNum2;
            MovieClip(idAnimation.content).gotoAndPlay(1);
            trace ("Type= " + idAnimation.content["Type"]);
            trace ("Num1= " + idAnimation.content["Num1"]);
            trace ("Num2= " + idAnimation.content["Num2"]);
          }
        }
    ]]>
    </mx:Script>
    
    <mx:SWFLoader id="idAnimation" source="assets/animation.swf" complete="changeParams()" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.