Passing variables / accessing other swfs

It has been years since I used flash, so I consider myself a
rank armature. I'm Using Flash 8 and would like the code to be
backward-compatible to ver. 6.
I have a big movie, with lots of images. I've comprimised the
image quality as much as I dare, but it still takes 20-30 seconds
to load (my client is in Paris, and claims to have the fastest
connection in Paris, but it takes more than a minute to load it
from there, even when loaded on his local server). I'm assuming
that the only way to achieve a meaningful decrease in load time
will be to split it up into smaller swf's, one mail swf, and each
sub-page in it's own swf, and have each swf loaded only when
needed. The fla can be downloaded here:
cjreynolds.com/fuda30.zip
The movie currently runs an intro animation, then when a link
is clicked, it loads different "pages" which consist of large movie
clips. These are contained in a MC called "pages", and are called
by manipulating a root variable called "level" - ie: "level = 1"
causes the MC at frame 1 of the "pages" MC to be displayed. (this
was an existing movie that I have been tasked with modifying).
#1 - Is it correct that splitting the individual pages into
different swfs the only way to lessen load time? I would welcome
any other suggestions.
#2 - If spitting the movie up is the way to go, I'm thinking
I need to replace the movie clips in the "pages" MC with swfs. How
do I tell each individual page to go back to the main (intro) swf
and load a different page? The main timeline contains animations
that "overlay" the sub-pages, creating a transision effect when
going from one page to the next.
Thanks for your help - you guys (and gals) have been a great
source of aid for me!
joe

Yes, _root is the wrong thing to use, and _global is never
good practice. I
don't use loadMovieNum - I'd use MovieClipLoader and it's
loadClip method to
load other swf's into target clips. You can then use
something like
this._parent to get to the timeline of the clip 'containing'
the loaded
clip.
However, I think your best bet is to probably use a singleton
class. That
way you have your main movie instantiate and set variables
within the
singleton - then any other movies can easily create an
instance (which will
be the same instance since it's a singleton) and get the
values you need.
Simple example:
class VariableHolder{
private static var instance:VariableHolder;
private var myA:Number;
private function VariableHolder(){}
public static function getInstance():VariableHolder{
if(instance == undefined){
instance = new VariableHolder();
return instance;
public function setVariableA(newA:Number){
myA = newA;
public function getVariableA():Number{
return myA;
So, in your main movie you'd do:
var myVariables = VariableHolder.getInstance();
myVariables.setVariableA(50);
And then in another movie you do:
var myVariables = VariableHolder.getInstance();
var myA = myVariables.getVariableA();
//will set myA = 50;
Because you're using a singleton - the second getInstance()
call returns
just the one class instance - held in the class' instance
variable. You can
have any/all movies instance the class, and only one instance
is ever
returned... Once you wrap your head around this it's a very
efficient way to
pass stuff around between various movies.
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/

Similar Messages

  • Passing variables from one swf to another

    I am facing problem to pass variable from one swf to another.
    I am using loadMovie to load another swf. how can I pass a variable
    value to another swf. Can anyone help me plz? It is somewhat
    urgent.
    thanx in advance.

    first of all:
    this is the Flash Media Server and your problem is not
    related to FMS....
    second thing related to the "somewhat urgent" :
    we, users on this forum, are not there to do your job... so
    calm down otherwise no people will answer your question. This forum
    is a free support forum that community of Flash developer use to
    learn tricks and to solve problems.
    Possibles solutions:
    If the two swf are seperate you can use LocalConnection to
    establish a connection between different swf.
    If you load a second swf into the first one you can interact
    like a standard movieClip(only if there from the same domain or if
    you a policy file on the other server)
    You can use SetVariable(via Javascript) to modify a root
    variable on the other swf and check with an _root.onEnterFrame to
    see if the variable had changed in the second swf.
    * MovieClipLoader will do a better job, in your specify case,
    than the loadMovie. Use the onLoadInit event to see when the swf is
    really totaly loaded into the first one otherwise you will have
    timing issues.
    My final answer(lol) is the solution 2 with the
    notice(*)

  • How to pass Variable value to SWF file in Eclipse development

    We are creating Widget file in Eclipse by using SAP Widget Foundation .
    We included one SWF file in Widget & it is working fine.
    But we are not able to pass the values to SWF file variables.?
    How to pass variables to SWF file let us know.
    Thanks & regards

    We are creating Widget file in Eclipse by using SAP Widget Foundation .
    We included one SWF file in Widget & it is working fine.
    But we are not able to pass the values to SWF file variables.?
    How to pass variables to SWF file let us know.
    Thanks & regards

  • Passing variables to a swf

    I'm trying to create a navigation file that is used to navigate to several applications. Each application is stored as a separate swf on the server. I need to send password data to each of the apps and I'm using the following code connect to each file and to send the password.
                var variables:URLVariables = new URLVariables();
                variables.connectionInfo = connectionPw
                var urlRequest:URLRequest = new URLRequest("http://... filename.swf");
                urlRequest.method = URLRequestMethod.POST;
                urlRequest.data = variables;
                navigateToURL( urlRequest );
    My problem is that I am unable to access the data when I am in the  connected file.I'm using
    password=Application.application.variables.connectionInfo
    but the variables are not showing up. How should I be doing this?
    Thank you!

    forty6n2,
    I tried to do the same thing, eventually after much searching
    I ran across something called flashVars. Essentially, you can pass
    values into flex and then do what ever you want with them. I
    wrapped my .swf file in an .asp page so that I could pass in the
    userID and ip address.
    Example:
    <object
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    id="MiscControls" width="362" height="280"
    codebase="
    http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
    <param name='flashVars' value='myName=<%=
    Response.Write(Request.ServerVariables("REMOTE_ADDR"))
    %>&myIP=<%=
    Response.Write(Request.ServerVariables("LOGON_USER")) %>'/>
    <param name="movie" value="MiscControls.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#869ca7" />
    <param name="allowScriptAccess" value="sameDomain" />
    <embed src="MiscControls.swf" quality="high"
    bgcolor="#869ca7"
    width="362" height="280" name="MiscControls" align="middle"
    play="true"
    loop="false"
    quality="high"
    allowScriptAccess="sameDomain"
    type="application/x-shockwave-flash"
    pluginspage="
    http://www.adobe.com/go/getflashplayer">
    </embed>
    </object>
    Good luck!
    - Mike

  • Passing variables to other classes

    Hi the problem im having is ive made 3 classes class A, A1 and A2 when i create A i also create A1 what i am wanting to do is if a condition in A1 is met it will pass a variable to A so A can delete A1 and then create A2, im having some dificulty in passing this variable back to A.
    Any help appreciated

    You mean you want to return a variable from a method in class A?
    Read:
    http://java.sun.com/docs/books/tutorial/getStarted/application/objects.html

  • FB4 Beta 2: Variables accessed across swf-files are null.

    I’ve been working on an ActionScript project and just recently switched from FB4 Beta1 to Beta2. The project is made up of multiple swf-files that are loaded into shell.swf. When compiled with FB4 Beta1 variables are accessible across the loaded swfs and shell.swf but they just turn up as being null when compiled with FB4 Beta2. What causes this behavior and how do I go about it?

    If you are using Marshall Plan functionality, it is no longer available by default.  You have to add the MXMLC option
    -includes=mx.managers.systemClasses.MarshallingSupport
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Passing variable information to swf

    I've created a flash file that imports photos from a database
    where the user is able to merge the photos with a variety of photo
    templates. I can pass the db info directly to the swf file with no
    problem, but if I use the html file with all the related flash code
    I can't seem to pass the code to the swf file. I'm not sure what
    I'm doing wrong and would appreciate any help........Thanks

    Thanks so much for replying. The code I'm using to pass the
    information is below. The information pulls from a DB into an asp
    page. Here's a url:
    http://www.pixstarr.com/details_mx.asp?event_Desc=SFDR100508&img_Name=S516_DSC0204-3.jpg.
    If you click the "Customize Prints" button on the left you'll see
    what it does....hopefully.
    It works fine if I pass the info to master.swf, but if I try
    to pass it to master.htm which contains master.swf I run into
    problems....Thanks again.

  • Pass filename as a variable to a swf file

    I want to pass a variable which will represent a filename to
    a swf file from a hypertext link in an HTML document.
    When the user clicks on the link which has
    ?variablename=filename_to_use appended to a "normal" link to a
    page,
    this variablename will be passed to the swf file.
    I've already created this target swf file to have an
    actionscript with a FLVPlayComponent with the filename hard-coded
    in the actionscript. I want the actionscript to use the variable
    representing the filename_to_use that was passed to from the URL
    line.
    The following is the actionscript that plays the flv file
    taken from the Flash Help: Creating an Application with an
    FLVComponent
    ORIGINAL VERSION:
    import mx.video.*;
    this.attachMovie("FLVPlayback", "my_FLVPlybk", 10,
    {width:320, height:240, x:100, y:100});
    my_FLVPlybk.skin = "file:///install_drive|/Program
    Files/Macromedia/Flash
    8/en/Configuration/Skins/ClearOverPlaySeekMute.swf"
    my_FLVPlybk.contentPath = "
    http://www.helpexamples.com/flash/video/water.flv";
    VERSION USING THE FILENAME FROM THE PASSED VARIABLE INSTEAD
    OF WATER.FLV
    import mx.video.*;
    this.attachMovie("FLVPlayback", "my_FLVPlybk", 10,
    {width:320, height:240, x:100, y:100});
    my_FLVPlybk.skin = "file:///install_drive|/Program
    Files/Macromedia/Flash
    8/en/Configuration/Skins/ClearOverPlaySeekMute.swf"
    my_FLVPlybk.contentPath = "
    http://www.helpexamples.com/flash/video/variable";
    I currently can play videos with this actionscript at my
    school website but must make a separate swf for each video.
    I want to be able to have one swf file that will play which
    video was passed from the link in the HTML page.
    I am using HTML page to lower the bandwidth so that users
    won't have to load a swf file to see curricular material and then
    perhaps choose a video on the topic.
    http://www.wearekennedy.com/kent/whatsup.htm
    click the link to the Spring curriculum map with resources
    and then click on e.g. The_Food_Web video
    Thank you,
    Kevin Kent
    Educator, John F. Kennedy H.S., Bronx, NY

    You can use Liskov substitution/polymorphism:
    DROP TYPE DEMO_T2
    DROP TYPE DEMO_T1
    DROP TYPE DEMO_ST
    CREATE TYPE DEMO_ST AS OBJECT
    ( ID NUMBER,
      MEMBER PROCEDURE THIS_PROC)
    NOT FINAL NOT INSTANTIABLE
    CREATE TYPE DEMO_T1 UNDER DEMO_ST
    ( OVERRIDING MEMBER PROCEDURE THIS_PROC )
    CREATE TYPE DEMO_T2 UNDER DEMO_ST
    ( OVERRIDING MEMBER PROCEDURE THIS_PROC )
    CREATE TYPE BODY DEMO_T1 AS
    OVERRIDING MEMBER PROCEDURE THIS_PROC AS
    BEGIN
       DBMS_OUTPUT.PUT_LINE('DEMO_T1');
    END;
    END;
    CREATE TYPE BODY DEMO_T2 AS
    OVERRIDING MEMBER PROCEDURE THIS_PROC AS
    BEGIN
       DBMS_OUTPUT.PUT_LINE('DEMO_T2');
    END;
    END;
    CREATE OR REPLACE PROCEDURE DEMO_PRC ( P_OBJ DEMO_ST) AS
      V_OBJ DEMO_ST := P_OBJ;
    BEGIN
      V_OBJ.THIS_PROC;
    END;
    -- TAKES AN OBJECT, NOT A PROCEDURE PER SE
    -- BUT ALLOWS THE PROCEDURE TO BE PASSED WRAPPED IN AN
    -- OBJECT
    BEGIN
      DEMO_PRC( DEMO_T1(1) );
      DEMO_PRC( DEMO_T2(1) );
    END;
    DEMO_T1
    DEMO_T2I believe that this is superior to the passing of function wrapped procedures as arguments because it is according to the intention of object orientation, whereas wrapping a procedure in a function is contrarty to the principles of good functional programming. Good practise in functional programming is to return a single strongly typed result, and produce no side effects. Since the procedure wrapped in a function is a procedure, it therefore implicitly have side effects.

  • How? Flex pass variables or call function in SWF

    Dear All:
    I am new in Flex.
    But I stuck with a problem for weeks.
    I wish to communication between Flex and Flash(swf).
    I tried to pass variable from Flex to Swf. (Call function in Swf also pass variables)
    I did some tourital on google by using SWFLoader, which works fine.
    BUT the AS code in SWF must in MAIN FRAME.
    I need put my AS code by using DOCUMENT CLASS.
    BUT when I using Document class, the method is not working.
    The flex cannot find function in Flash.
    PS.I already set main.as class as public
    Hope some one can give some hint.
    I really get a huge headache.
    Many thanks,
    Henry

    myIP wrote:
    > or perhaps more ideal;
    >
    > for(var sVar in flashVars)
    > {
    > i++;
    > //var mcName = sVar.substr(0,3);
    >
    > // create the MCs:
    > duplicateMovieClip(_root.testBut,"medium"+sVar,i);
    > _root["medium"+sVar].testText.text=sVar;
    > _root["medium"+sVar].mcName = sVar.substr(0,3);
    >
    >
    > // assign the function to each created MC:
    > _root["medium"+sVar].onRelease = function()
    > {
    > trace(this.mcName)
    > _root[mcName]._x=0;
    > }
    > }
    >
    thanks but this does not work.
    I think that the problem is that the variables defined in the
    for loop do not exist in the scope of
    the function.
    when the MC is clicked, and the onRelease function says:
    _root[mcName]._x=0;
    the variable "mcName" is empty.
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    An Ingenious WebSite Builder:
    http://sitelander.com

  • Accessing Captivate 5.5 variables from embedded SWFs

    Hi,
    as we all know the interface for accessing Captivate variables from embedded SWFs tends to change between Captivate versions. Shortly after it's release we upgraded to version 5.5, and I'm not succeeding in accessing the Captivate variables in my Flash/AS3 code the same way it was done in version 5.
    How should I access the Captivate 5.5 variables (rdinfoCurrentSlide et al) from my SWFs?

    Hi,
    You can use system variable : cpInfoCurrentSlide to show the slide number.
    So you can use text captions to display the value of the variable, the format for displaying the value stored in the variable is $$<system variable>$$. So for slide number use : $$cpInfoCurrentSlide$$, type this in the text caption and then check it in the preview.
    Thanks

  • How to access variables from other class

        public boolean inIn(Person p)
            if  (name == p.name && natInsceNo == p.natInsceNo && dateOfBirth == p.dateOfBirth)
                 return true;
            else
                 return false;
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phello,
    here am trying to compare the existing object with another object.
    could you please tell me how to access the variables of other class because i meet this error?
    name cannot be resolved!
    thank you!

    public class Person
        protected String name; 
        protected char gender;      //protected attributes are visible in the subclass
        protected int dateOfBirth;
        protected String address;
        protected String natInsceNo;
        protected String phoneNo;
        protected static int counter;//class variable
    //Constractor Starts, (returns a new object, may set an object's initial state)
    public Person(String nme,String addr, char sex, int howOld, String ins,String phone)
        dateOfBirth = howOld;
        gender = sex;
        name = nme;
        address = addr;
        natInsceNo = ins;
        phoneNo = phone;
        counter++;
    public class Store
        //Declaration of variables
        private Person[] list;
        private int count;
        private int maxSize;
    //constructor starts
        public Store(int max)
             list = new Person[max];//size array with parameters
             maxSize = max;
             count = 0;
        }//end of store
    //constructor ends
    //accessor starts  
        public boolean inIn(Person p)
           return (name == p.name && address == p.address && natInsceNo == p.natInsceNo);
        }//returns true if Person with same name/natInsceNo/dateOfBirth as phope it helps now!

  • Passing Captivate Variables to Embedded swf

    Hello,
    How can i read a captivate variable in embedded swf file like cpInfoCurrentSlide;
    Thanks

    var cpRoot:Object = MovieClip(root);
    var mainmov:Object = MovieClip(cpRoot.parent.root);
    mainmov.cpInfoCurrentSlide
    mainmov.rdinfoCurrentSlide
    Some things only work with the old rd variables.
    This works for 6 and 7, I haven't tested on 8 yet.

  • OBIEE 11g How to pass variable from one prompt to another prompt in dashboard page.

      How to pass variable from one prompt to another prompt in dashboard page.
    I have two prompt in dashboard page as below.
    Reporttype
    prompt: values(Accounting, Operational) Note: values stored as
    presentation variable and they are not coming from table.
    Date prompt values (Account_date, Operation_date)
    Note:values are coming from dim_date table.  
    Now the task is When user select First
    Prompt value  “Accounting” Then in the
    second prompt should display only Accounting_dates , if user select “operational”
    and it should display only operation_dates in second prompt.
    In order to solve this issue I made the
    first prompt “Reporttype” values(Accounting, Operational) as presentation
    values (custom specific values) and default presentation value is accounting.
    In second prompt Date are coming from
    dim_date table and I selected Sql results as shown below.
    SELECT case when '@{Reporttype}'='Accounting'
    then "Dates (Receipts)"."Acct Year"
    else "Dates (Receipts)"."Ops
    Year"  End  FROM "Receipts"
    Issue: Presentation variable value is not
    changing in sql when user select “operation” and second prompt always shows
    acct year in second prompt.
    For testing pupose I kept this presentation
    variable in text object of dashboard and values are changing there, but not in
    second prompt sql.
    Please suggest the solution.

    You will want to use the MoveClipLoader class (using its loadClip() and addListener() methods) rather than loadMovie so that you can wait for the file to load before you try to access anything in it.  You can create an empty movieclip to load the swf into, and in that way the loaded file can be targeted using the empty movieclip instance name.

  • How can I pass variables from one project to another using Javascript?

    Hi all, I am trying to do this: let learners take one course and finish a quiz. Then based on their quiz scores, they will be sent to other differenct courses.
    However, I wish keep track on their previous quiz scores as well as many other variables.
    I found this nice widge of upload/download variables by CPguru (http://www.cpguru.com/2011/05/18/save-and-load-data-widget-for-adobe-captivate-4-and-adobe -captivate-5/). However, this widget works by storing variables from one project in local computer and then upload it to another project.
    My targeted learners may not always use the same computer though, so using this widget seems not work.
    All these courses resided in a local-made LMS which I don't have access to their code. Therefore, passing variables to PHP html files seems not work.
    Based on my limited programing knowledge, I assume that using Javascript to pass variables may be the only possible way.
    Can someone instruct me how to do this?
    Thank you very much.

    If you create two MIDlet in a midlet suite, it will display as you mentioned means you can't change the display style.

  • Passing variable having value as whole SOAP request to command while invoking ODI WS call

    When passing variable in place of soap request message (variable value is whole SOAP request message prepared using procedure) in ODI Invoke WebService command like -->
    OdiInvokeWebService "-URL=url...." "-PORT_TYPE=..." "-OPERATION=..." "-RESPONSE_MODE=NEW_FILE" "-RESPONSE_FILE_CHARSET=UTF8" "-RESPONSE_XML_ENCODING=UTF-8" "-RESPONSE_FILE=..." "-RESPONSE_FILE_FORMAT=SOAP" "-HTTP_USER=..." "-HTTP_PASS=..."
    #SOAPREQUESTMESSAGE
    Gives error :
    ODI-1226: Step OdiInvokeWebService 1 fails after 1 attempt(s).
    ODI-1241: Oracle Data Integrator tool execution fails.
    Caused By: com.sunopsis.wsinvocation.SnpsWSInvocationException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '#' (code 35) in prolog; expected '<'
    at [row,col {unknown-source}]: [1,1]
        at com.sunopsis.wsinvocation.client.impl.AbstractMessageImpl.loadFromXML(AbstractMessageImpl.java:333)
        at com.sunopsis.wsinvocation.client.impl.AbstractMessageImpl.loadFromString(AbstractMessageImpl.java:348)
        at com.sunopsis.wsinvocation.client.impl.AbstractMessageImpl.fromString(AbstractMessageImpl.java:403)
        at com.sunopsis.wsinvocation.client.impl.AbstractJWSDLParserImpl.fromXML(AbstractJWSDLParserImpl.java:272)
        at com.sunopsis.wsinvocation.client.impl.AbstractJWSDLParserImpl.getWebServiceRequestByOperation(AbstractJWSDLParserImpl.java:260)
        at com.sunopsis.dwg.tools.common.WebserviceUtils.getSOAPMessage(WebserviceUtils.java:94)
        at com.sunopsis.dwg.tools.common.WebserviceUtils.invoke(WebserviceUtils.java:138)
        at com.sunopsis.dwg.tools.InvokeWebService.actionExecute(InvokeWebService.java:327)
        at com.sunopsis.dwg.function.SnpsFunctionBase.execute(SnpsFunctionBase.java:276)
        at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java:3437)
        at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeOdiCommand(SnpSessTaskSql.java:1509)
        at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:44)
        at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:1)
        at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
        at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
        at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
        at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
        at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
        at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
        at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
        at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
        at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
        at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
        at java.lang.Thread.run(Thread.java:662)
    Thanks in anticipation...

    the used variable 'SOAPREQUESTMESSAGE' is being created in a procedure using jython.
    1. Can we use this variable (SOAPREQUESTMESSAGE) value in the next step that is while invoking web service request (can it persist) ?
    2. If not then how can we use this variable value to invoke ws request in next step ?
    Would like to appreciate help.
    Pls reply.

Maybe you are looking for