Accessing instance variables from container

I am new to Flash. I am a programmer, not a designer so this
is my first foray into Actionscript.
I am creating a slide show player in Flash. It retrieves an
XML file containing other .swf files that should be played, the
order in which they should be played, the length of time each one
should show, and the text that should be displayed.
For example:
<presentation>
<globals>
<setting name="use_transitions" value="false"/>
<setting name="use_delays" value="false"/>
</globals>
<slide src="slide5.swf" text="Slide 1" delay="10"/>
<slide src="slide3.swf" text="Slide 2" delay="10"/>
</presentation>
I have everything working except for the loaded .swf file
picking up on the text to display.
I can set the Var: property on the dynamic text field to
_root.dynamic_text and it will load what is in the variable
dynamic_text just fine.
However, the slide3.swf and slide5.swf file have default text
in them that should who if there is no text specified.
It seems that variables inside a loaded movie are not in
scope.
I load the movie using:
loadMovie(slides[nIndex][0], "slideMovie");
However if my instance name on my dynamic text field is
"theText" this code does not work:
this.slideMovie.theText.text = dynamic_text;
How do I dereference the dynamic text field?
Thanks for any help.

quote:
Originally posted by:
abeall
I didn't really follow your set up.
> this.slideMovie.theText.text = dynamic_text;
Where is that code placed? Where is theText? Where is
dynamic_text defined, or what is it? _txt usually signifies a
TextField instance, but if that was the case then the statement
would not do anything. Are you trying to access objects in the
external slide SWF before it has been loaded and initialized?
I'm sorry that I wasn't clear enough.
Maybe this will help.
============== Begin Code ==============
slide3.swf
========
_root
layer |------> Instance of Graphic Symbol
-----------------------> Dynamic Text Object named
'theText'
layer |------> Instance of Graphic Symbol
-----------------------> JPEG Graphic Background
layer |------> Actionscript Layer
slide_show engine.swf
==================
_root
layer |------> Movie Clip Object named 'slideMovie'
layer |------> Actionscript Layer
Actionscript code snippet:
/* This becomes a two dimentional array of slides.
* slides[index][0] is the .swf file to load.
* slides[index][1] is the transistion to load. (Not
currently used.)
* slides[index][2] is the delay to wait (in seconds) until
the next slide shows.
* slides[index][3] is the customized text to show the loaded
slide. If blank show the default text.
var slides = new Array();
var dynamic_text;
var nIndex = 0;
var main:Object = new Object();
main.switch_slides = function()
if (nInterval != -1)
clearInterval(nInterval);
if (nIndex >= slides.length)
return;
_root.dynamic_text = slides[nIndex][3];
loadMovie(slides[nIndex][0], "slideMovie");
this.slideMovie.theText.text = _root.dynamic_text;
nInterval = setInterval(main, "switch_slides",
(slides[nIndex++][2] * 1000));
// Code to load and parse the configuration file deleted for
brevity.
============== End Code ==============
The slides are made by our designer. Most of which animate
the background image and then fade in the text.
The text object usually does not exist in the first key
frame. So my workaround is probably the only way this can be done.
The workaround needs to go in every slide's actionscript
layer on the first key frame.
The only real problem I have with it is that I need to put
the default text in the actionscript. Putting a Var reference in
the dynamic text will remove the text there if the variable is
empty.
However trying to dynamically create the var reference does
not seem to work. For example:
In the slide3.swf file if I have the following code on the
actionscript layer, the var reference in the dynamic text does not
get pulled in properly:
if (_root.dynamic_text)
this.dynamic_text = _root.dynamic_text;
I need to put the var reference at the top with the default
text. For example:
var dynamic_text = "default text";
if (_root.dynamic_text)
this.dynamic_text = _root.dynamic_text;

Similar Messages

  • Accessing Instance variables from within javascript

    Is it possible to access Instance variables of a JSP using
    javascript? If so, an example would be very much appreciated.
    LaMont

    <script language="JavaScript">
    var scriptVar = "<%= jspVar %>";
    </script>

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • Accessing public variables from other classes

    Probably a simple questions, but how can I access a variable from another class. My exact situation is as follows.
    A class called WorldCalender has a variable which is defined: public int hour; (the value is given to it elsewhere).
    I want to access this variable and increase it by one in a subroutine in the class Hour. In this class I have put: WorldCalender.hour++; but it doesn't seem to work. How should I do it?

    don't expose the hour variable at all.
    have a method eg addToHourBy( int hrs )
    Probably a simple questions, but how can I access a
    variable from another class. My exact situation is as
    follows.
    A class called WorldCalender has a variable which is
    defined: public int hour; (the value is given to it
    elsewhere).
    I want to access this variable and increase it by one
    in a subroutine in the class Hour. In this class I
    have put: WorldCalender.hour++; but it doesn't seem to
    work. How should I do it?

  • Accessing instance variables within frames.

    I have 2 jsf within frames that is having one managed bean.
    i would like to access the instance variable defined in one jsf from another jsf. Since the managed bean is getting instantiated for the second jsf, the values in first jsf is getting reintialized.
    Is it possible to access like this? or do we need to have a separate backing bean and call the first from second.

    <script language="JavaScript">
    var scriptVar = "<%= jspVar %>";
    </script>

  • How to access a variable from within a symbol.

    How do I access a variable set outside a symbol from within that symbol?
    Thanks

    If you set a variable on stage ,say
    sym.setVariable("stageVariable", "I am stage variable");
    You can access it from within  a symbol using :
    var myVariable = sym.getComposition().getStage().getVariable("stageVariable");
    Basically you need to get handle to the symbol in which the variable is defined.

  • How to invoke BPM object instance variable from interactive activity?

    I have a screenflow with an automatic activity "A" followed by an interactive activity "B". "B" calls a BPM object "X" and uses a JSP presentation to show its attributes. Is there a way to use another BPM object, say type "Y", create an instance variable of that type inside "A", and get its attributes values from the JSP page associated to "B"?
    Edited by: user6473912 on 20/07/2010 03:37 PM

    Try this. It assumes you have:
    <li> a user named "auto"
    <li> a project variable named "customerType"
    <li> an instance variable named "orderAmount" that is a decimal
    <li> an instance variable named "order" that is a BPM Object that has attributes named "customerName" and "amount"
    ps as ProcessService
    xmlObject as Fuego.Xml.XMLObject
    do 
      connectTo ps
          using url = Fuego.Server.directoryURL,
          user = "auto",
          password = "auto"
      instF as InstanceFilter
      create(instF, processService : ps)
      addAttributeTo(instF, variable : "customerType", comparator : IS, value : "Gold")
      instF.searchScope = SearchScope(participantScope : ParticipantScope.ALL, statusScope : StatusScope.ONLY_INPROCESS)
      for each inst in getInstancesByFilter(ps, filter : instF) do
        // here's how to get the value inside a primitive instance variable
        orderAmtObj as Object = getVar(inst, var : "orderAmount")
        // here's how to get the value of attributes inside a complex BPM Object instance variable
        //    - in this case this is an "order" object with two attributes (customerName and amount)
        orderObj as Object = (getVar(inst, var : "order"))
        xmlObject = Fuego.Xml.XMLObject(createXmlTextFor(DynamicXml, object : orderObj, topLevelTag : "xsi"))
        logMessage "The value of the order object's customer name is: " +
               selectString(xmlObject, xpath : "customerName")
        logMessage "The value of the order object's order amount is: " +
               selectNumber(xmlObject, xpath : "amount")
        // here's a rather uninspired way to retrieve who the participant is that was assigned the instance
        logMessage "The participant assigned to this instance is: " + inst.participantId
      end
    on exit
      disconnectFrom ps
    endDan

  • Is there any way at all of accessing captivate variables from flash?

    Hi,
    I would be grateful for any help on this one.  I have been working in flash and I wanted to know whether there is any way at all of calling/accessing captivate 4 variables from flash (I'm working in flash Cs4 Actionscript 3.0 and I'm trialling Captivate 4, but I just want to know whether there is any way/method of communicating between a flash file and a captivate 4 file, and if so, can this be done with an embedded captivate 4 file/swf).  Surely there must be a way of communicating between the two - they are both Adobe products!
    Thanks for any help, pointers, advice, tips in advance.

    Hi Louon,
    Don't know if this would help you.
    http://blogs.adobe.com/captivate/2009/09/captivate_variables_-_how_to_a.html
    We have many experts here who could give more precise answers.
    Cheers.
    Miguel

  • Access payroll variables from custom payroll function

    Hi All,
    I have a requirement to create a custom payroll function that returns some data from IT0006 and IT0032.
    I have written the code in PCBURZDE0, as the payroll is for Germany, it does read the data needed.
    My question is, how I can access the variables specified for the function in the payroll schema.
    Schema definition in PE01
    Zeile     Fkt        Par1  Par2 Par3 Par4 D Text
    000010 BLOCK BEG                              Fahrradleasing
    000020 _DFRD &PRO GEN
    000030 BLOCK END
    If I double-click Par1 for function _DFRD (&PRO), then I see he two variables I should write the data to:
    Zeile  VarArg. FZ T Operation        Operation Operation Operation Operation Operation *
           -------------+---------+------------------+---------+---------+---------+---------+
    000010                  AMT= PKWWRPRINT     *
    000020           1     AMT= ENTKM  PRINT
    So, as I understand I should write the two variables PKWWR and ENTKM, I have the values in the function code, but I don't know how to access these variables.
    Thanks for your help!
    Gyöngyi

    1 - PIT is a Function that is used in the Payroll Schema to "Process the Internal Table".
    2 - You mentioned that you had created a Custom Function to read IT0006 and IT0032, and I only suggested to you that you could have that Custom Function generate Information WageTypes and save them in the Input Table where they could then be used in PCRs.
    3 - I did not mention that you can read only one value through operation AMT, but I mentioned that using AMT=xxxxxx followed by AMT=yyyyyy means that the first statement is useless.  On the other hand, using AMT=xxxxxx followed by AMT+yyyyyy and AMT+zzzzzz will result in the amount being the total of the 3 values.
    4 - Please read some documents on Schemas, Functions and PCRs, such as in the Wikis on this site, and study your current Payroll Schema, it's sub-schemas, it's functions and the operations in it's PCRs.  Note that t-code pe01, pe02 and pe04 can be used to find some documentation on functions and operations.

  • Accessing another variable from another application

    I was wonder how I can access another variable form another application?
    For example: I want to access :P4_EMPLOYEE_NAME from app ID 104 when I am doing is from an activity in page 2 on app ID 142.
    I had a search before, but I am looking for an unambiguous response.

    Greg - About all you can do is call the function htmldb_util.fetch_app_item(p_item => 'F104_ITEM', p_app => '104'). The application you call this function in must be sharing a session with the application from which you are fetching the item, both applications must belong to the same workspace, and the item you name in the argument must be defined as an application-level item in the fetched-from application.
    Scott

  • How to access environment variables from pluggable destination?

    Hi,
    I'm trying to create a java puggable destination for reports. Everything is working fine.
    I want to access reports environment variables from the java code (like REPORTS_PATH and other new variables that I want to create), but I can't find anything about this in the java API documentation.
    I want to use environment variables instead of destination properties (those I can easily access), because I want to be able to change context using env_id.
    Any ideas?
    Thanks,
    Luis

    I'm using Oracle Application Server Version 10.1.2.0.2
    Thanks

  • How to access a variable from one program to another (independent)

    Hi,
    My requirement is to use a variable(value) from one program(prog1) to another (prog2). how is it possible.
    Regards
    Arani Bhaskar

    Go for memory id .
    passing on values from one program to another program
    Program1
    EXPORT (variable) TO MEMORY ID 'LOC'.
    Program2
    IMPORT (variable) FROM MEMORY ID 'LOC'.
    LOC is the address , for more press f1 on export in abap editor.

  • Problem accessing session variable from jsp

    Hi!
    I get an error retrieving a session variable from inside a JSP declaration scriptlet....
    Something like this code in a JSP page:
    <%!
    public void funtion1() {
    String parameter1 = session.getAttribute("parameter1");
    %>I have seen that I have available getContextServer() method and from there I could call getAttribute("parameter1") . But the thing is that the attribute I want to retrieve was stored in session by another Jsp page.
    Any solutions are welcome
    Cheers
    Victor

    Appropriately the above is one the reasons also You cannot use JSP implicit objects from the declaration tag. However we can think of a small workaround by passing the reference like the one discussed below
    <%!public void funtion1(HttpSession session) {
    String parameter1 = session.getAttribute("parameter1").toString();
    }%>
    <% funtion1(session);%>Hope that helps :)
    REGARDS,
    RaHuL

  • Accessing Instance Variables

    Hi,
    I am trying to make a presentation that shows all instance variables of a determined process's instance.
    In order to do that, I have created a Gloabal Interactivity Activity with a presentation that ask for a key.
    So, I want to show in the next presentation all the instance variables of the instance processes that has the key informed by the user on the previous presentation.
    How can I do that?
    Thanks very much
    Marcos

    <script language="JavaScript">
    var scriptVar = "<%= jspVar %>";
    </script>

  • Accessing _root variable from flex

    In Flex code, I am trying to access a variable that I pass to
    the Flash object through FlashVars argument. In Flash it is easy to
    do as all the variables that as passed as a part of FlashVars
    appear as a part of _level0 or _root. Is there any way to do it in
    Flex?
    I am trying pass a large dataset directly to Flash without an
    http call (creating a desktop application). Does anyone know if the
    FlashVars approach will work for a large dataset or is there a
    better approach?
    Thanks

    From the Flex 2.0.1 help (search for Using flashVars):
    The following example sets the values of the firstname,
    middlename, and lastname flashVars properties inside the
    <object> tag in a simple wrapper:
    <?xml version="1.0"?>
    <!-- wrapper/ApplicationParameters.mxml -->
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="initVars()">
    <mx:Script><![CDATA[
    // Declare bindable properties in Application scope.
    [Bindable]
    public var myName:String;
    [Bindable]
    public var myHometown:String;
    // Assign values to new properties.
    private function initVars():void {
    myName = Application.application.parameters.myName;
    myHometown = Application.application.parameters.myHometown;
    ]]></mx:Script>
    <mx:VBox>
    <mx:HBox>
    <mx:Label text="Name: "/>
    <mx:Label text="{myName}" fontWeight="bold"/>
    </mx:HBox>
    <mx:HBox>
    <mx:Label text="Hometown: "/>
    <mx:Label text="{myHometown}" fontWeight="bold"/>
    </mx:HBox>
    </mx:VBox>
    </mx:Application>
    If you are using the wrapper that is generated by Flex Data
    Services or wrappers that are included in the
    resources/html-templates directory, your wrapper might not look the
    same, but the basic approach to passing the flashVars variable is.
    For example, you might insert flashVars variables by appending them
    to a function parameter, as the following example shows:
    "flashvars","historyUrl=%2Fflex%2Fflex%2Dinternal%3Faction%3Dhistory%5Fhtml&lconid="
    + lc_id + "&firstName=Nick&lastName=Danger",

Maybe you are looking for