How do they interact between the stage and the classes?

Hello

I asked this question before, and all I got is 'Go back to reading beginner books', so I hope that someone here is willing to actually answer my question rather than brushing because they were unwilling to help...
And Yes, I have read books on the topic and been through tons of documentation and not found the answer to this. I have 1 ActionScript and JavaScript experience, so this whole thing shouldn't be this hard.

I am using ActionScript 3 in Flash CS3.

My problem is the following:

I need to know how to send commands between the stuff on the stage and stuff which is defined in a class.
I had this problem for centuries and kept trying to find ways around it since so far I couldn't find help for her.

For example:
When you use a document class, how can I get the number of the current frame of the stage?
Or using a class of documents, how can I access any object (such as a MovieClip with instance name) who has been on the scene with the IDE?

Currently, to be more precise, I'm doing something really simple:
Make a button work on my scene, which is not always visible. With AS3, which is not as easy more than before.
So what I have now, is to create the button in the document class, used addChild and set it to alpha = 0.

Now, when the stage reached specific images (i.e. those with labels, and I got this part understood), it is supposed to make the button visible. Then I can add stuff and event listeners, and I can understand this part myself.

I do not know how to access the number of stage of the document class setting, so I put it in a script of frame in frame 1, but now this script cannot access the button that is defined in the document class.

It makes me bananas...

Please, here, can someone someone explain to me how can I make this work?

I've seen many diagrams of the list of display and the object hierarchy, but none of this, explains how to USE effectively all...

Thank you in advance to anyone who is willing to spend the time to answer!

Well, first of all, I must say that AS3 is fundamentally designed to be difficult on purpose, this interaction between the objects is intentionally very strict. For this reason, I always use AS2 to all my basic work of Flash. AS3 is just much more involved, much tighter, much less forgiving... it takes a lot of experience with it before it begins to make sense.

Now, I think I might have a few answers to your questions:
Any DisplayObject instance (this includes any class of Document, which must extend MovieClip or Sprite instances) you can access the scene using the "stage" property

However, stadium is probably not exactly what you want, you want the main timeline, which is a child of the stage. To access the main timeline, you can use the 'root' of any DisplayObject property.

However, unless you have the strict mode off, Flash will let you just say 'root.myMovieClip' because the root property is of type DisplayObject, that is not a dynamic class (which means that you cannot add properties to it) and it has not built in the "myMovieClip" property, so he thinks you did a mistake. You have to "climb" the root as a MovieClip property, which * is * dynamics so it will allow you to try anything on this subject of reference (like AS1/2 does with everything.)

So what this means is it should work from the inside, document you class:

.myMovieClip (root as MovieClip)
or
MovieClip (root) .myMovieClip

Either successfully make reference to a MovieClip you set on the main stage in the IDE and named 'myMovieClip '.

Rather than set the alpha to 0, try the visible parameter to false. I think that this will disable all interactive events, where simply setting alpha to 0 it would still be interactive.

HTH

Tags: Adobe Animate

Similar Questions

  • How to share events between the classes?

    I have my main application and a sub class that shows such a menu. Suppose that, in this menu, a button exists. If the button is clicked, I want to do something in my main application based on the clicked button class. How can I achieve that?

    Sorry, does not work

  • What is the interaction between appellant VIs and subVIs using VI Server?

    I am student at the CLAD and one of the lines in the document preparation or here is the following:

    What is the interaction between appellant VIs and subVIs using VI Server?

    I know how to use the function "Call for reference" to call a VI, but not necessarily a Subvi. I thought a Subvi is always loaded with the calling VI and has nothing to do with the server of VI. What Miss me?

    Hi Bmihura,

    I think that this article will clear up how the VI Server works with subVIs called statically or dynamically.

    Call a VI by reference

    Best regards

  • How to check latency between the ESX host and SAN

    How to check latency between the ESXi host and SAN

    Hi friend

    Below KB will solve your need:

    VMware KB: Using esxtop to identify problems of performance of storage to ESX / ESXi (several versions)

    Under discussion can help you get more insight:

    Best values LVAD/cmd (ESXTOP)?

    Learn ESXTOP @ latency:

    vCenter and Esxtop to storage i/o bottlenecks to avoid

    Very detailed blog on ESXTOP:

    http://www.yellow-bricks.com/ESXTOP/

  • How place of content between the header and tabs?

    I have the header part which must be constant through the portal but below that I have 3 links
    as I AM an employee, employer, broker...

    which showed that in the homepage above the tabs...
    How can I do this...

    How place of content between the header and tabs...: () kindly help...

    Hey djo
    Try these approaches and see if it works.

    1. in the header Section, page footer you shell header and add a Portlet header. This JSP file associated header Portlet will be all static content in the upper part. In the lower part, add these 3 links say right. Show these links only based on certain properties of the query as isHome. Now for the main book House and another page associate a BackingFile. In this backup file in the lifecycle methods preRender or handlePostBack, get BookManager instance and all pages and see which page is active. For this page, see its page definition label which will be always unique. IF the page def label is like home_page_def (it is the wording of the page def you give to the homepage), then set the value of the key in the request as isHome = true property. The only doubt is after book backingfile is triggered, the header needs to be reloaded, because only then can he pick up the attributes of the request.

    2. create a new portlet as HomePageLinks portlet. Its title property is not Visible and other properties of the UI as NoBorder, etc. NoTheme. The associated JSP will be the 3 links you mentioned fixed right. You can use css styles to make it right. Now dropping this portlet in the header Shell box. You have already HeaderPortlet in the upper part, lower than that, you will have this portlet HomePageLinks. Now associate a backup file for this Portlet show, only if the current active page of books is the home page comparing the label def etc. as mentioned above.

    In both scenarios, only concern is when clicked on different Pages, the entire portal is to be made directly from the header at the top. Only then the backup file will be set the key and the portlet HomePageLinks can show or hide as a result.

    Try to raise an event when the user clicks on the homepage. This port listening for that event can be HomePageLinks Portlet. I guess the event mechanism should work regardless of where the portlet is placed. In the event listner, see if you can show/hide this portlet.

    The only challenge is reloaded must section header whenever you click on a tab.

    Start putting a few files of backup and System.out.printlns to see if the header section gets recharged on, click on the tabs.

    These are just my thoughts on the top of my head. Other users of the forum may have better alternatives or a different version of the above approaches.

    Thank you
    Ravi Jegga

  • Interaction between the two forms

    Hi all

    IAM a beginner to this Summit. I have a problem with the interaction between the forms.

    I have a relationship with the table where I have included for each line like this radio button
    "Select APEX_ITEM. RADIOGROUP (1, r.ID,'7 ') as P10_RG,
    r.ID,
    r.Ref_ID,
    r.Customer_name,
    p.Name as product,
    s.Name as Source,
    c.Name as country,
    of product p, requirements_maintenance r, source, country c

    so if I have a radio button on a particular line and you click a tab in the header, go to another form where I should be able to get details of the line I selected in the previous form.

    I tried several ways to get the values using javascript, but it grabbed nulls as
    $x('P10_RG_0').value but I do not get it.
    Please can someone me wat is the solution for this?

    Hello

    If your next page (ie the redirected page) is page no. 10

    "Select APEX_ITEM. RADIOGROUP (1, r.ID, 'null', null,'onclick = "document.location.href =" f? p = & APP_ID.: * 10 *: & SESSION.: REGION3: & DEBUG.:RP:P10_R_ID:' | r.ID |'") » ''") "

    and on page no. 10 have an element named P10_R_ID as a hidden item.

    Good bye
    Sonny_starck

  • How to switch manually between 7690 Radeon and Intel HD3000 on Envy 15 - 3001TX?

    Someone let me know "How to switch manually between 7690 Radeon and Intel HD3000 on Envy 15 - 3001TX?" as there no viable just as switching button does VAIO...

    Thank you

    Hello

    Please check this:

    http://h20000.www2.HP.com/bizsupport/TechSupport/document.jsp?lang=en&cc=us&ObjectID=c02731962&JumpID=reg_R1002_USEN

    Kind regards.

  • How to filter dates between the current date and the number of dates past

    Hello

    On the answers, how can I do to return a report that contains data between the current dates and 31 days in the past?

    Users want to connect display the report and the report should show only data 31 days to the date of the day... How would I be able to set it up on the answers that since I have not access to RPD?

    Please let me know

    Thank you

    use the date filter between current_date and timestampadd (sql_tsi_day, -31, current_date)

    fixed

  • Marshall plan: how to pass data between the main field and sub-application

    Hello

    I'm trying to load a Flex 3.5 application in Flex 4. In the process, I need to move a strong local typed object from main application to the loaded swf file. And I also have to pass a rope and a bitmap of application sub to the main application. Have an example to show how to pass data in the application domain?

    Thank you

    SW

    Define scaleContent = true, set a breakpoint on SWFLoader.as:doScaleContent and

    see if he thinks there's a swfBridge.

  • How Exchange View screen between local files and remote server?

    I just need to know how to switch the display between local files and remote server, I want my files the on the left and the remote server on the right.  I had it set up before, but just got a new computer and can not remember how I did it.

    Its OK, I found it. Thank you

  • OOP - how to pass variables between the branches of the object, but not instances of VI

    I have a main VI where a thread object goes through some subVIs initialization and then branches off into several parallel loops. My understanding is that each branch becomes a separate instance of the object. Data is passed between the loops using global variables, wrapped in the accessors (I can change this if someone has a better approach - reducing to a minimum the memory and the CPU usage is very important).

    I need to have a large number of instances of the main VI running at the same time. What would be the best way to ensure that the data transmitted between the loops of one instance of VI do not interfere with the data transmitted between the loops of another instance of VI?

    Thank you for your understanding.

    Ah, you're right. Stupid mistake on my part. It's all working now. The corrected code is attached.

  • How to share files between Windows XP and Windows 7 without password?

    Hey guys, I want to share files between windows 7 and windows XP. I don't want to put the password on my Windows 7 or Windows XP account. I am going on my Windows XP perfectly shared files from Windows 7, but I am not able to go on my files of windows 7, the cause of my XP he asks user name and password. I enter the user name and it does not accept it if I make a password for my windows 7 and enter as the user name... I don't know what to do guys any help?

    Windows 7 only WILL NOT allow you to share files without a password, it's all just a common sense safety requirement.  It of a very bad practice to run your Windows installations with a null value, a password, give your facility a valid password.

    The simplest around your problem is to create an account with the same names and passwords on each machine and so typed the password when the connection is too a problem allow AutoLogon on the machines.

    John

  • Interaction between the expansion of the initial view & bookmark Destination

    I use Adobe Acrobat X.

    I understand that the definition of the destination of a bookmark also sets the magnification of the view. Apparently, it's always the case, and that doesn't seem right to me.

    Suppose that all I want is for each bookmark to take the reader to a particular page, and I don't want the expansion of any different view of enlargement that the player is currently using. For example, I set the initial view, magnification by default when you create the PDF file. How can ensure me that the reader will not deal with a different point of view magnification when you click on a bookmark and be redirected to the page?

    Select the existing action "go to a page in this document", as you did in the 3rd and 4th example you view and click the button change, and you should see where you can select "Inherit Zoom" for the zoom setting.

    Edit: I see that you found.

  • How to share tabs between the two sync'd devices?

    I have firefox Sync between my home and work computer. I wonder if there is a way by which I can view share or retrieve tabs open between devices?

    After synchronization try wait history drop-donw, you will see an option tabs to another computer

    Also:

  • How do they affect times a clip and the clip from movie of child in the same function?

    I have really two questions: how both affect a clip and the clip from movie of child in the same function? and how to get information of a component in one service for another?

    My basic setup is a clip of choice of fonts, one on each image: "bodyText_mc." Each of these frameworks has a clip of the child 'bodyText_mc.bodyText' with choice of alignment for the police. For example, the user chooses 'Script' in the first ComboBox, then selects "Align right" in the second. (This text is static, because I need more great design control I can get with dynamic text.)

    First of all, I have a combobox "cbBodyFont" that I use to go from one image to the image on movieclip 'bodyText_mc.' It works fine:

    cbBodyFont.addEventListener (Event.CHANGE, changeBodyFont);

    function changeBodyFont(e:Event):void {}

    var bodyFontFrame:String = cbBodyFont.selectedItem.data;

    bodyText_mc.gotoAndStop (bodyFontFrame);

    }

    However, if I also want to assign a child element of "bodyText_mc", like this:

    cbBodyFont.addEventListener (Event.CHANGE, changeBodyFont);

    function changeBodyFont(e:Event):void {}

    var bodyFontFrame:String = cbBodyFont.selectedItem.data;

    bodyText_mc.gotoAndStop (bodyFontFrame);

    bodyText_mc.bodyText.gotoAndStop (2);

    }

    It won't let me. Add a command to the clip of the child 'bodyText_mc.bodyText' runs to a null object reference error. I can affect the parent element or the child element, but not both. Why?

    And part 2 of my question:

    I have an another combobox "alignBodyCb" that I use to go from one image to the image in this child clip "bodyText_mc.bodyText". The user selects Center, left, or right alignment.

    alignBodyCb.addEventListener (Event.CHANGE, changeBodyAlign);

    function changeBodyAlign (e: Event): void {}

    var elementAlignBodyFrame:String = alignBodyCb.selectedItem.data;

    bodyText_mc.bodyText.gotoAndStop (elementAlignBodyFrame);

    }

    The problem is that when the user switches to a new image of "bodyText_mc" with the changeBodyFont function, always, it goes to frame 1 of the child clip "bodyText", change the font, but back to the alignment of the centre. I need the font combobox to "remember" the active data from the drop-down list alignment, can still send the clip of the child to that frame. What I want is something like this (although it obviously does not):

    cbBodyFont.addEventListener (Event.CHANGE, changeBodyFont);

    function changeBodyFont(e:Event):void {}

    var bodyFontFrame:String = cbBodyFont.selectedItem.data;

    bodyText_mc.gotoAndStop (bodyFontFrame);

    bodyText_mc.bodyText.gotoAndStop (elementAlignBodyFrame); <--(l'image sélectionnée par fonction d'autres combobox)

    }

    alias "go to the frame (do) that they just took and then send the clip of the child to the frame (alignment) they chose earlier."

    Help? If I'm going about this wrong in the first place, I am open to that, too.

    SWF file attached for Visual reference. (Not everything works yet, but the Type of body section is where I concentrate for the moment).

    Just to avoid any confusion in the timeline (not yours, Flash), I recommend alternating the movieclips bodyText of one layer to another with empty frames between those on the same layer.  Funny things can happen when you have adjacent keyframes of the things, and giving them the same name may be composed the strangeness is at stake.

    If kGlad wants to take action to tackle the rendering event thing, it's OK, but whatever it is, I don't think that it is involved in what I mean.

    All I'm saying is that when you go to a particular frame in the bodyText_mc, you must run this second line of code here and not back where you had it.  If you want to move the command for the bodyText movieclip go to a frame inside the bodyText_mc on the frame where it lands in your first line of code.

Maybe you are looking for

  • Restoring Windows XP on Qosmio G20

    Hi all I have problems with my Qosmio running slow and I suspect some virus or Trojan. So I decided to restore my system, but to my surprise, it's that I can't find a windows restore cd. Is this possible? I don't have a CD that said QosmioPlayer Reco

  • Special keys do not work

    Special keys (such as volume, brightness, WiFi market etc) do not work after the last windows start-up. I'm not what I remember installing something to upgrade. All rights of the BIOS settings. What is happen? Has anyone else experienced this problem

  • Cannot install updates code Error 8007000 b, dt000-Windows Vista

    I tried many things and nothing worked. The only update that installs is update for windows defender-KB915597 definition Please HELP

  • Unable to connect my wireless laptop

    Unable to connect my HP laptop to my connection Wireless netgear which is attached to my desktop Dell computer. Worked previously, but have not turned on my laptop for about 2 months or so.

  • Hello, I just downloaded creative cloud, but it does not run

    Hello, I just downloaded creative cloud, but it does not run