Access the property of main class in loaded swf.

Hi
i have one main.fla, its document class is main.as. the code in main.as is
package
import flash.display.MovieClip;
public class Main extends MovieClip
private var loading:Loading;
public var trovami:Number=10;
public function Main()
stage.frameRate=31;
loadSWF();
private function loadSWF():void
loading=new Loading(this);
Loadind.as is another class where i load another swf its name is my_swf.
the code of loading class is:
package
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.text.TextField;
import flash.display.Loader;
import flash.events.*;
import flash.net.URLRequest;
public class Loading extends MovieClip
private var _fla:MovieClip;
private var url:String;
public var val:String;
private var loader:Loader;
public function Loading(fla:MovieClip)
_fla=fla;
init();
private function init():void
url='my_swf.swf';
var request:URLRequest=new URLRequest(url);
loader=new Loader();
initListeners(loader.contentLoaderInfo);
loader.load(request);
private function initListeners(dispatcher:IEventDispatcher):void
dispatcher.addEventListener(Event.COMPLETE,completato);
private function completato(event:Event):void
_fla.addChild(loader);
loader.y=10;
val="hello"
and the document class of loaded swf is Main2. in my_swf.fla there is one text its name is:
a_txt.
so i have to use property of Loading class in Main2 for text.
code of Main.as is
package
import flash.display.MovieClip;
import flash.text.*;
public class Main2 extends MovieClip
public function Main2()
a_txt.text=val;
where val is the property of Loading class.
so how can i access.

You have a reference to your loaded movie within your Loading class - instead of just setting val to a string - add a method in your Main2 class - and call that from Loading - passing the string to it. Push not pull...
Main 2 becomes:
public function Main2() {
     //a_txt.text=val;
public function setText(val:String):void {
    a_txt.text = val;
And then in your Loading class - when you're done loading just call setText:
private function completato(e:Event):void
    addChild(loader);
    loader.y=10;
    MovieClip(loader.content).setText("hello");
    //val="hello";

Similar Messages

  • Pass parameters to a function in main class from loaded SWF?

    I've got a main.as that loads SWF to the stage.
    the loaded SWF seppoused to pass a link to the main.as and trigger a javascript function to popUp that photo from that link.
    I know there are two ways:
    ((root as MovieClip).parent.parent as Object).somefunction(parameters);
    and to dispatch an event.
    inorder to pass parameters throug the event i need to extend it with another class.
    isnt the (root as... )  more efficient if all i need is to pass a link?

    when a photo from the gallery is selected a javascript popUp shows it enlarged with additioan editing options (kinda like in facebook).
    in that popUp ther is also a next button so its kinda bidirectional. (the next calling the loaded SWF throug main to get the next link in the photo array)
    the photo is a grandchild of a grandchild of the stage and the loaded swf is a grandchild so using:
    ((root as MovieClip).root as MovieClip).ExternalInterface.call("ShowPic", link);
    is discusting ><

  • Flash builder - 101 - access the property of an  object in a component

    hi all,
    very basic Q for flash builder -> air app ->
    |-mainapp.mxml
    |-components.master.mxml
    |-com.xlab.mca.mytest.as
    {not full code}
    in the mainapp.mxml
    xmlns:xtra="components.*
    <xtra:master>
    </xtra:master>
    in master.mxml I have a text input field 
    <s:TextInput x="106" y="72" id="textinput1"/>
    from an onclick I am calling an AS3 component
    import com.xlab.mca.mytest; //THIS WORKS FINE
    in the component mytest.as I have to get the value of the textinput
    var ttt:String;
    ttt = escape(FlexGlobals.topLevelApplication.textinput0.text);
    if I have the textinput in the mainapp.mxml it works fine,
    but how do I access the property if it is in a component.*
    thx
    Art

    and where would i put the remove.simpleScreen ( simpleScreen is the loader i would want to remove )
    would it be on the external swf on frame 1 where the slideshow plays?
    or in the main timeline's category's frame?
    the problem ( that i see ) is that both loaders are on the same frame ( different layers tho )
    so if i put a the remove simplescreen there it wont show me the pictures when i click the thumbs
    or could i make it so that it removes it BECAUSE its playing on frame 1 ?

  • Accessing the ServletContext from a class that is not a Servlet?

    Is there any way of accessing the ServletContext from a class that is not a
              Servlet? The class is being used as part of a Web Application.
              Thanks.
              

    http://www.mozilla.org/mirrors.html
    Mozilla has download mirrors around the globe. If it is on the list, it is trustworthy.

  • Accessing the attributes of a class using field symbols?

    An option to pulll a variable into a user exit that otherwise would be out of reach is detailed [here|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/208811b0-00b2-2910-c5ac-dd2c7c50c8e8]
    Can a similar approach involving field symbols or otherwise, be used to pull in the attributes of a class into the exit? For now, I'm trying to access the A_FRONTEND_INDEX attribute of the class CL_HRXSS_REM.
    any ideas?
    ~Suresh

    Hi,
    Have you already tried (PROGRAM)(OBJECT)->A_FRONTEND_INDEX in your code? I prepared small testing scenario with two programs and it works.
    REPORT  zmv_test1.
    FORM test.
      FIELD-SYMBOLS: <fs> TYPE ANY.
      ASSIGN '(ZMV_TEST2)zip->crc32_map' TO <fs>.
      IF sy-subrc EQ 0.
        <fs> = 'Test'.
      ENDIF.
    ENDFORM.                    "test
    REPORT  zmv_test2.
    DATA: zip TYPE REF TO cl_abap_zip.
    START-OF-SELECTION.
      CREATE OBJECT zip.
      PERFORM test IN PROGRAM zmv_test1.
    Cheers,

  • How to extend property of main class

    hi all I hv made an class object in library that is mainBox.as , i hv  5 diffrent frames in it
    1) home (it contains 4 links about,images,history,contact)
    2) about
    3) history
    4) contact
    now i wanna trying to do when user on home frame that contains (about images,history,contact) inks and when user click on any link then it will jump on req. frame and then it's extended class will give the property... Like when user is in images then there can be an interactive image gallery, that will be handle through an extended class of mainBox class, so i wanna try to make diffrent pages to diffrent classes. you can find my source file through this link,
    https://sites.google.com/site/amit0shakya/home/extend-class-problem
    thank you
    [email protected]

    I think you have to use thread for concurrency>>>>..

  • (261229964) Q RPCC-10 Where would a client application access the "waterworks.services.WaterUsage"  class?

    Q <RPCC-10> Where would a client application access the "waterworks.services.WaterUsage"
    package that it imports - and what is contained within it?
    A <RPCC-10> The WaterUsage interface is the remote interface for the stateless session
    bean that the RPC style web service uses for the business processing and it is included
    in the client.jar file for that RPC web service.

    Q <RPCC-10> Where would a client application access the "waterworks.services.WaterUsage"
    package that it imports - and what is contained within it?
    A <RPCC-10> The WaterUsage interface is the remote interface for the stateless session
    bean that the RPC style web service uses for the business processing and it is included
    in the client.jar file for that RPC web service.

  • Invoking class from loaded swf

    I'm working on a project where I'm loading in a video player
    as an external swf to my main movie. I'm not able to get my video
    or the custom player to show up, but sound is there (I've done the
    whole Library>New Video thing, so I have a video object to
    reference).
    My question is: My loaded swf uses #include to include a
    script which imports two classes from a subdirectory, could that be
    causing the problem? My main movie never uses the classes.
    Just want to make sure this isn't my problem before I go
    digging into the script again!

    That is unlikely to be the problem. The .as includes are
    compiled into the
    SWF at publish. Much more likely is that you have
    inappropriate references
    to _root in your loaded movie. As it stands, the scope of
    _root, once you
    load the movie into another, is the _root of the *loading*
    movie. Either
    change these refs, or set the _lockroot property of the mc
    you are loading
    into to true.,
    Remove '_spamkiller_' to mail

  • Control main timeline from loaded swf.

    Hi,
    I'm using a textfield for debug information.
    I'm loading an swf on the main timeline and I'm showing the status in the debug textfield.
    function swfLoaderCompleteHandler(event:Event)
         Debug.text +=  "Swf loaded.";
    That works.
    But,
    I'm loading a png file in the loaded swf. , I'm trying to show the status of the png file as I showed the status of the swf.
    function pngLoaderCompleteHandler(event:Event)
         MovieClip(parent).Debug.text += "Png loaded.";
    I can't control the main swf from inside the loaded swf. Even gotoAndStop or calling a function doesn't work.
    Do I need to add something when I load the swf, saying it's a MovieClip or something?
    Here's a fla too. http://flashfocus.nl/forum/attachment.php?attachmentid=9885&d=1282509233

    Thank you! you're brilliant!
    For people with the same problem:
    If you use CS5 and you have a TLF text on the stage, it doesnt work... I think it's a bug. But when I converted my TLF textfield to classic and everything works fine!

  • What is the relation between main class and inner classes

    hi
    i want to make a UML design and o want to know how to draw the relation betwwen the main public class and inner classes?
    and what is the relation?

    BaffyOfDaffyA wrote:
    Please keep in mind that if you spell better you will get better answers and if you add duke stars you will get better answers and if you mark the thread as a question you will get better answers. That will make it look like you are paying attention and that you really want an answer.
    My best answer based on your rather vague question:
    A minimal public class in a file named "Minimal.java" in the directory named "minimal":
    package minimal;
    public class Minimal {
    private int variable;
    public Minimal(int var) {
    variable = var;
    public int getVariable() {
    return variable;
    }This would be an example of adding an inner class:
    package minimal;
    public class Minimal {
    private int variable;
    public Minimal(int var) {
    variable = var;
    public int getVariable() {
    return variable;
    public class Inner {
    private int innerVariable;
    public Inner(int var) {
    innerVariable = var;
    public int getInnerVariable() {
    return innerVariable;
    }The inner class is exactly like any other inner class except if you are accessing it from anything else other than Minimal then you would have to add Minimal. right before Inner for example, where the Minimal class could use
    Inner inner = new Inner(5);other classes would have to use
    Minimal.Inner inner = new Minimal.Inner(5);
    See [Inner Class Example|http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html] or [Nested Classes|http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html] for more information.
    He is probably not asking what an inner class is or how to declare one in raw source code. To me he is asking how do I
    explain this relationship in a UML diagram and as UML is not and exact science and expression can vary a lot
    between UML design applications I didn't want to stab in the dark.
    @OP I would say whatever seems most logical to you and your team, write something that reads.

  • How to access the objects from  multiple classes in  ABAP Objects

    <b> Give me The scenario and solution to the above problem </b>

    In abap OO you can have only one super class.
    multiple inheritence can be acheived by inheriting multiple interfaces.
    abap OO is similler to that of JAVA in inheritence.
    so you can not have classes a and b both as super at same time for a class.
    however if still you want to acheive your perpose then you can do it using heirarchical inheritance where b inherits a and c inhrites b. so this way public methods will be accesible in c
    do revert back if any other doubt.
    check this link for more clear picture:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dba81635c111d1829f0000e829fbfe/frameset.htm
    regards.
    kindly close the thread if problem by awarding points on left side.
    Message was edited by: Hemendra Singh Manral

  • Two issues, purchased bamboo fun, disk for adobe has been registered under an old email. cannot access   the disk for adobe will not load onto computer states need shockwave, downloaded but the disk says it is not there

    with the bamboo fun have disk which has been registered under another old email account.  This has compounded by the inability for the adobe photoshop element unable to install onto my pc.  it continues to state, cannot install as your pc does not have the shockwave player.  I have tried to download this and it states it is installed but cannot open the file. 
    my question is cannot i have the adobe elements downloaded from internet with the serial numbers, and two need shockwave player to work,

    Well if you do not want win7 all together, then just delete all the partitions and install your XP. But if your not wanting to mess up this drive to be able to use the win7 later then just buy a cheap HDD to put XP on. --> http://www.newegg.com/Product/Product.aspx?Item=N82E16822148452 $10 off and free shipping. but being that you already tried installing XP then you already messed up win7 anyways(if you did not make the restore disks), your better off just deleting and redoing XP.
    IT Specialist and Consultant
    Lenovo Tablet Evangelist
    Current Machines: IdeaCentre A300, ThinkPad Tablet, IdeaPad U410, and Yoga 3 Pro Touch
    Deutsche Community   Comunidad en Español
    Lenovo - the latest in DOtabs, DOpads, DOcentre's, DOstations and DOservers!

  • Accessing the text/property file inside the root context

    Hi
              I want to access the property file lying inside the root context folder
              via plain java classes using IO.
              Could you please help me out.

    Hi
    Using this.getClass().getClassLoader().getResource("config_settings");
    In order to load the properties file, uses the classpath search mechnism.
    Basically it means that java will look for your file in the classpath.
    The defualt class path of a web server is usualy the following:
    ContextName/Web-Inf/Classes;ContextName/Web-Inf/lib
    This is why it is working for you when you put your properties file under ContextName/Web-Inf/Classes, but it doesnt work when it is under ContextName/*, as this is not a part of the classpath search.
    You have 3 options:
    1.Put you properties file under the sever defulat classpath
    (ContextName/Web-Inf/Classes;ContextName/Web-Inf/lib,if it's under lib, the file has to be inside a jar file)
    2.Add ContextName/* to your server classpath ( in tomcat->setClasspath.bat file )
    3.Instead of using "this.getClass().getClassLoader().getResource("config_settings"
    read your file directly using the java.io.* library and give it the full path to the file,
    you can store the full path in web.xml file, or using getServletContext().getRealPath("") to locate the context path and read the file from there( but then you are using the Servlet API )
    Hope it helps
    all the best
    tal

  • Problems creating jar in netbeans - Failed to load main-class

    Hi,
    I was wondering if someone could help with a problem I'm having creating a jar. I have a project in netbeans 6.5 and used Netbeans' GUI Builder (matisse) to create some of the UI elements in the project. I've tried many times to do "Clean and Build" to build my project. It builds successfully, but the jar that gets created gives the following error:
    "Failed to load Main-Class manifest attribute from C:\... filepath here...."
    I checked the manifest file, and that contains:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: 11.0-b16 (Sun Microsystems Inc.)
    I tried adding Main-Class: gui.MainGUI (which would be the class that contains my main function) to this file and tried running it again, but it then said "Invalid or corrupt Jarfile" when I try running it. MainGUI does exist in the Jar. I also tried with just Main-Class: MainGUI, same error.
    Does anyone know what I'm doing wrong? In NetBeans, if you go to the project properties, Main Class is specified as "gui.MainGUI" also, so that isn't the issue. Additionally, I have Swing Layout Extensions and Swing Application Framework included in the added libraries (required for the GUI builder, I think).
    Thanks for any help.

    Try creating a new Java project and be sure to choose project type Java Application.
    Copy source code to the newly created project and try again.

  • Accessing the inner class written inside the method

    Hi all,
    Can any of you tell me how to access the inner class's method which is written inisde the outer class's method. THe code fragment is
    class Outer
    private static final int ID = 3;
    public String name;
    public void methodA( int nn )
    final int serialN = 11;
    class inner
    void showResult()
    System.out.println( "Rslt= "+ID );
    } // end class inner
    // new inner().showResult();
    } // end methodA
    class Sample
    public static void main(String a[])
    //access the showResult of Inner class??
    Thanks in advance.
    aah

    class Outer {
      private static final int ID = 3;
      public String name;
      public void methodA( int nn ) {
        final int serialN = 11;
        class inner {
          void showResult() {
            System.out.println( "Rslt= "+ID );
        } // end class inner
        new inner().showResult();
      } // end methodA
    class Sample {
      public static void main(String a[]) {
        new Outer().methodA(5);
    }

Maybe you are looking for

  • Photo streaming synch problem.

    Today has appear an "unknow" picture on mi iPhone 4's streaming folder (IOS 6.1), I suppose this picture was downloaded to my iPad (wifi+3G IOS 5.1)  and then deleted from the camera roll and the streaming (because it's any more). Both devices  are u

  • Conditional disable no longer works

       We have a large application that calls modules dynamically.  It has been working in LV 8.2.  We compile the main program and use "Source Distributions" to distribute modules for individual installations.  Thus these modules are LV source code in d

  • Testing a Static Web Service Client Proxy

    Hi all, I have followed all the steps for Database Web Service Callout Utilitiy 10.1.3.1 but stuck at this point. C:\OraHome_3>jpub -u dbws@lokal3 -sysuser sys@lokal3 -proxywsdl=http://localhost:8888/javacallout/javacallout?WSDL -endpoint=htt p://loc

  • How do I delete a game app I tap it it jiggles but no x appears I can't delete it

    How do I delete a game app I touch it it jiggles but no x appears I can't delete it

  • Function module for quotation configuration update

    Hi, I am trying to update the configuration data for an item in quotation. This is a new item i am trying to insert in a quotation using BAPI 'BAPI_CUSTOMERQUOTATION_CHANGE' but not able to update/change the configuration data. I am able to upload th