How do I acces a var from the main time line in to a movieclip?

I'm making a quiz-type animation, since I'm new with ActionScript I had developed my own way to make this work.
I want to add like a meter that shows one out three position depending on the answer given, I had made this animation as a movieclip but now I need it to react according to the answer, so it changes on every question to do that I need to access the variables I'm using in the main time line, how can I access the the main time line variables from the movie clip?
The movie clip (meter) is basically the background and the questions will change and advance on top of that movie clip so it'll change with each answer until you get the final result.
Since I cant attached my FLA file here I could email my it to whom may want to help me, THANK YOU!!!

I kinda of make it work using what you suggested: var meterVar = MovieClip(this.root).userAnswer;, but I have different problems now I'm getting this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
     at divameter2_fla::MovieClip_1/frame1() and the meter movieclip only change from the original position to the second and stays there even if the first answer supose to sent it to the third or four position. here is the code for the main and movie clip:
Main:
The following code I have it in separate frames, I know is probbably not the best way to do it but I'm new with AS.
Frame 1:
stop();
messageBox.text = "";
var userAnswer:int;
var rbg:Object = rbA.group;
var finalScore:int;
btnCheck.addEventListener(MouseEvent.CLICK, nextBtn);
function nextBtn(evt:MouseEvent):void {
             userAnswer = int(rbg.selectedData);
             if(userAnswer == 0) {messageBox.text = "Please select an option";
             }else{
                 finalScore = userAnswer;
                 gotoAndPlay(2);
Frame 2:
stop();
messageBox.text = "";
var rbbg:Object = rbbA.group;
btnCheckTwo.addEventListener(MouseEvent.CLICK, nextBtnTwo);
function nextBtnTwo (evt:MouseEvent):void {
             userAnswer = int(rbbg.selectedData);
             if(userAnswer == 0) {messageBox.text = "Please select an option";
             }else{
                 finalScore = finalScore + userAnswer;
                 gotoAndPlay(3);
Frame 3:
stop();
messageBox.text = "";
var rbcg:Object = rbcA.group;
btnCheckThree.addEventListener(MouseEvent.CLICK, nextBtnThree);
function nextBtnThree (evt:MouseEvent):void {
             userAnswer = int(rbcg.selectedData);
             if(userAnswer == 0) {messageBox.text = "Please select an option";
             }else{
                 finalScore = finalScore + userAnswer;
                 gotoAndPlay(4);
Frame 4:
stop();
messageBox.text = "";
var rbdg:Object = rbdA.group;
btnCheckFour.addEventListener(MouseEvent.CLICK, nextBtnFour);
function nextBtnFour (evt:MouseEvent):void {
             userAnswer = int(rbdg.selectedData);
             if(userAnswer == 0) {messageBox.text = "Please select an option";
             }else{
                 finalScore = finalScore + userAnswer;
                 gotoAndPlay(5);
Frame 5:
stop();
messageBox.text = "";
var rbeg:Object = rbeA.group;
btnCheckFinish.addEventListener(MouseEvent.CLICK, finishBtn);
function finishBtn (evt:MouseEvent):void {
             userAnswer = int(rbdg.selectedData);
             if(userAnswer == 0) {messageBox.text = "Please select an option";
             }else{
                 finalScore = finalScore + userAnswer;
                 if (finalScore > 4) gotoAndPlay(6);
                 if (finalScore > 9) gotoAndPlay(7);
                 if (finalScore > 13) gotoAndPlay(8);
The las theree frames are the 3 different results and the code they have is only a stop();
The following is the movieclip code:
stop();
var meterVar = MovieClip(this.root).userAnswer;
var btnCheck = MovieClip(this.root).btnCheck;
var btnCheckTwo = MovieClip(this.root).btnCheckTwo;
var btnCheckThree = MovieClip(this.root).btnCheckThree;
var btnCheckFour = MovieClip(this.root).btnCheckFour;
btnCheck.addEventListener(MouseEvent.CLICK, nextBtn);
     function nextBtn (evt:MouseEvent):void {
             if (meterVar == 1) {gotoAndPlay(2);
                 if (meterVar == 2) gotoAndPlay(3);
                 if (meterVar == 3) gotoAndPlay(4);
             }else{ gotoAndPlay (1);
btnCheckTwo.addEventListener(MouseEvent.CLICK, nextBtnTwo);
     function nextBtnTwo (evt:MouseEvent):void {
             if (meterVar == 1) {gotoAndPlay(2);
                 if (meterVar == 2) gotoAndPlay(3);
                 if (meterVar == 3) gotoAndPlay(4);
             }else{ gotoAndPlay (1);
btnCheckThree.addEventListener(MouseEvent.CLICK, nextBtnThree);
     function nextBtnThree (evt:MouseEvent):void {
             if (meterVar == 1) {gotoAndPlay(2);
                 if (meterVar == 2) gotoAndPlay(3);
                 if (meterVar == 3) gotoAndPlay(4);
             }else{ gotoAndPlay (1);
btnCheckFour.addEventListener(MouseEvent.CLICK, nextBtnFour);
     function nextBtnFour (evt:MouseEvent):void {
             if (meterVar == 1) {gotoAndPlay(2);
                 if (meterVar == 2) gotoAndPlay(3);
                 if (meterVar == 3) gotoAndPlay(4);
             }else{ gotoAndPlay (1);
I had attached the almost working FWS file

Similar Messages

  • How to print out multilingual reports from the main report using Xliff temp

    Hi all,
    How to print out multilingual reports from the main report using Xliff temp?
    When I want main report call subtemplate and finish xliff tranlation
    <?for-each@section:INVOICE?><?end for-each?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    Prints out fine with Finnish translation
    But if I want in main program to check what language is used e.g.
    if trx_number = 142 call Finnish translation and if trx_number =144,
    call English translation.
    <?for-each@section:INVOICE?><?end for-each?>
    <?if:TRX_NUMBER=’142’?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    <?end if?>
    <?if: TRX_NUMBER=’144’?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.US/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    <?end if?>
    Prints out always in English and never the Finnish translation.
    Program goes fine to if branch but does not print out Finnish
    Does anybody know what could be wrong?
    BR
    Kari

    Thanks Amit,
    I have two layout, main-layout and sub-layout
    Main layout call subtemplate
    I have registered layout and xliff-file
    Main template
    Localized Templates
    File Name           Language Territory
    XXNS_INVOICE_MAIN.rtf      English
    SUB template
    Localized Templates
    File Name           Language Territory
    XXNS_INVOICE_SUB.rtf      English
    Translatable Template
    File Name           Language      Territory
    XXNS_INVOICE_SUB.rtf      English      United States
    Available Translations
    Language Territory Progress
    English Finland Complete
    If main report call subtemplate and finish xliff tranlation
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    Prints out fine with Finnish translation
    But if I want in main program to check what language is used e.g.
    if....
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    .....end if;
    if....
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.US/?>
    .....end if;
    Prints out always in English and never the Finnish translation.
    Program goes fine to if branch but does not print out Finnish
    Do you it's set up problem or program problem
    BR
    Kari

  • Can I access a label inside of an MC and then go back to the main time line

    Here is my current set up.
    I have a labeled section on main time line which has icons of 12 different videos. Each icon acts as a button and brings a user to a labeled section with a FLV Video Playback component impemented to play the corresponding video. These labeled sections are located on the main time.
    This methog makes my main time line very long. Is there a way to make an additional MC which will hold all the video buttons and then have this MC separated into labeled sections.
    In other words can I access a label inside of an MC and then go back to the main time line?
    My present code for accessing the label located on the main timeline is:
    HowTo_maininfo_mc.theArrangement_btn.addEventListener(MouseEvent.CLICK, theArrangement_btn_amimated_btnDown);
    function theArrangement_btn_amimated_btnDown(event:MouseEvent):void {
    gotoAndPlay("theArrangement");
    How would it look if my label "theArrangement" would be located inside of an MC?
    Is there any specific code if I want to have a close button located on the label inside of an MC and it needs to fire out to a label located on the main timeline?

    Oh, WOW! It is working perfectly now.
    My mistake was that I was specifiying the var sourceVar:String;
    for every single button. It was not clear to me from the first example that it has to be specified only once.
    I made a small test Flash file and everything works now. It still doesn't work on my big flash file, I guess some other code messes it up and I can' not figure what it is exactly.
    I would like to include the OUTPUT error message in hopes that you can spot right away what a mistake could be:
    VideoError: 1000: Unable to make connection to server or to find FLV on server
              at fl.video::VideoPlayer/stop()
              at fl.video::FLVPlayback/stop()
              at acolyteVideos_fla::mainsite_mc_2/stopF2()[acolyteVideos_fla.mainsite_mc_2::frame484:21]
              at flash.display::MovieClip/gotoAndPlay()
              at acolyteVideos_fla::mainsite_mc_2/onClick_GoBackToHowTo2()[acolyteVideos_fla.mainsite_mc_2 ::frame484:13]
    If there is no immediate cure for it, I will go through code line by line. Since it is working on the test it must be something wrong with my main file.
    Additiona question (please let me know if I should paste it as a new thread)
    I have similar set up with UILoader. Where different buttons set up to bring a user to individual labeled sections with individual UILoader. Should it be arranged in the same way that it is only one loader and "var sourceVar:String;" code is the one which brings up different content for each button?

  • How can I delete an item from the main left column of iTunes?

    I'd like to delete an item from the main left hand column in iTunes (the column containing the main headings LIBRARY, STORE, SHARED, PLAYLISTS etc etc). Under the first heading 'LIBRARY' appear the items Library, Music, Movies, iTunes U, Books, Apps and Ringtones. I'd like to remove the item "Library" from that list - it appears immediately after the heading "LIBRARY" and serves no purpose whatsoever. (Neither does it appear to cause any harm, I must say, just a nuisance.) This item does not appear in any of the iTunes viewing options or controls lists. Neither does it appear in iTunes in the other accounts on my Mac and I have yet to see it any other iTunes on any other Mac.
    I've upgraded since about iTunes 8 assuming the problem would eventually disappear through the upgrades but it hasn’t, even through all the providedupgrade increments available for iTunes.
    I'm assuming it's from something I've installed in my main user account at some stage and it entered this item in the iTunes app. But I can't see how to remove it. The only things I can remember installing are "iTunes Batch Column Renamer" and "Join Together", both if which are just Scripts and which I use fairly regularly, but I don't recall either of them installing that particular item.
    Is there any folder I can navigate to to edit the list of items in that main left hand column of iTunes?
    Many thanks in advance for any help offered.

    on second thought, that you have an item "library" is indeed odd - there shouldn't be.
    suggest you try removing iTunes completely (click here and follow the instructions), then reinstall it using the standalone installer from here: http://www.apple.com/itunes/download/.
    note this will not do anything to your media files, playlists, ratings, etc.
    btw, you didn't install any 3rd party tools like this script:
    Change Hidden iTunes Preferences v2.4 
    This application will allow you to invoke hidden iTunes preferences:
    Show "Library" playlist
    Changing view setting is global
    Allow half-stars in ratings
    Hide "Ping" buttons
    Show/hide arrow links -- to either search the iTunes Store or search your library
    Load complete iTunes Store preview before playing
    Create playlists for purchased song collections
    Play songs while importing or converting
    Create file names with track number
    Maintain grid view for Search results
    Option-click zoom button for Mini Player&
    Show buttons horizontally
    Message was edited by: Jolly Giant

  • How to compile an .air app from the ADT command line?

    Hi,
    I would like to compile an .air app from the ADT command line.
    Does anybody have an example?
    I don't know how to add the AIR SDK path and a folder to it.
    Is there a generator for the command line availabble?
    Thanks

    Correction: it seems that Applescripts and some similar scripts can be called from the command line using "osascript scriptname". I don't speak automator but you might like to try it. osascript seems to come with severe limitations though, for instance it doesn't allow user interaction such as dialogue boxes.

  • How to separate an accessory toolbox from the main (default) toolbox?

    Hi,
    I accidently snapped a toolbox (containing the Transform, Align and Pathfinder tools) to the main (default) toolbox on the left of the window. Now I can't unsnapp it.
    If I close the toolbox (by clicking the "x"), it also closes the main toolbox... It seems Illustrator just considers it is part of the main toolbox.
    If I uncheck the "Tools" in the "Window" menu, only the default toolbox disapears (which is promising!), but if I close it and re-check the Tools, both toolboxes are still displayed.
    Any idea of how I can separate the two toolboxes? It's not urgent, but it blocks my view and it is getting annoying... Thanks in advance!

    Click into the header bar (either the dark grey for one whole set of panels or just the light grey tab for one panel) and drag it out of the group

  • Access the main time line function

    Hi all,
    In as2 we can use _root to access the main timeline function from the inside some movieclip or button.
    In as3 how to access the main timeline function from inside the movieclip or button.can any one please tell me.

    "root" is the AS3 equivalent, but using it alone will often not wortk.  You more often need to cast it as some form of object before the compiler will recognize it.  Using "MovieClip(root)" will usually do the trick.

  • Controlling the main time line of a movie via a button within a movie on a different level.

    Hi there!
    I have two movie is two different levels,
    Level 5 is my base movie and I am loading another movie on
    top of this into level 10.
    Once the user clicks onto a button within the movie on level
    10, I would like the animation in level 5 to stop (the animation
    runs on the main root timeline of level 5).
    Once the user clicks on a different button within the movie
    on level 10, I would like the animation on the main timeline of the
    movie in level 5 to start again from the point where it previously
    left off.
    Is this possible?
    It would be great if someone could help me out with this.
    Thanks, midi_ie

    midi_ie wrote:
    > Hi there!
    > I have two movie is two different levels,
    > Level 5 is my base movie and I am loading another movie
    on top of this into
    > level 10.
    > Once the user clicks onto a button within the movie on
    level 10, I would like
    > the animation in level 5 to stop (the animation runs on
    the main root timeline
    > of level 5).
    >
    > Once the user clicks on a different button within the
    movie on level 10, I
    > would like the animation on the main timeline of the
    movie in level 5 to start
    > again from the point where it previously left off.
    > Is this possible?
    _level5.gotoAndPlay("someLabelframe");
    Use your regular action to target timeline or movie clips,
    just define the level number at the beginning of the path.
    Pretty much it :)
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    Happy New Year
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • How can I control print quantities from the main browser?

    So here's the workflow question
    I want to select photos to print but I want to print a different quantity depending on criteria. The photos may be in different albums, etc..
    Selecting them all and trying to set the quantity in the Print Order window is painfully awkward.
    What I really need to be able to do is browse my photos and assign a value to them where the value represents the number of prints that should be created for that photo.
    For example, I can assign those colored lables quite easily by just pressing  CMD-1, CMD-2, CMD3, and so forth.
    So lets suppose I navigate around my photo collection and I assign a color to particular photos where the number of the color represents the desired quantity.
    It's very easy then to create a smart album that just shows the photos that have been tagged this way.
    However, there is no way then to order prints in one go with the appropriate quantities (other than the manual mechanism in Print Order window) and if I order them as separate groups, I have to pay shipping costs multiple times.
    I'm wondering if someone has created an automation script that can use the color (or some other textual tag) that can then be used to submit a print order with the quantities of each photo derived from that color or textual tag?
    I hope this question makes sense, it feels awkward to describe.

    If you have an iPhone, you can go to the app store and get Keynote Remote for free. The trick to make it work smoothly is to first establish your Macbook Air as wireless network. Then you use your iPhone to control the slideshow remotely, by swiping from slide to slide -- even from quite a distance.
    Turn on your Macbook Air's airport (wi-fi), then select Create Network.
    Once your Macbook Air is turned on as a network, open Keynote on your computer and your slideshow, but don't start the "view slideshow" mode just yet.
    Open up Keynote Remote and if it doesn't connect automatically to your Macbook Air then select the network in Options.
    Then start your slideshow from your iPhone -- you will notice each slide appearing on your iPhone as a reference.
    If you still have difficulties linking, go into the Keynote preferences menu on your computer and make adjustments in the tab Remote. (And don't be fooled by the Bluetooth option -- strangely at this point it doesn't work between the iPhone and the Macbook -- only wireless.)
    *Extra: You can enable "speaker notes" to show up on your iPhone below the picture of the slide.

  • Manage the mc timeline from the main

    Hi guys,
    I need to use gotoAndPlay with a timeline situated within a MC. So, how can I identify this timeline from the main one?
    P.S. could anyone advise me a good As 3.0 manual?

    Assign an instance name to the mc via the properties panel.  Let's say you name it "mc"... then to command that timeline from the main timeline you would use: mc.gotoAndPlay(?);

  • How do I set a variable on the main timeline from within a symbol?

    Just getting started with Animate and coming to it from Flash, as may be apparent from my question. How do you set a variable to the main timeline from within a symbol?
    I have 24 pairs of clickable elements, each in their own symbols, and all 24 of those symbols sit inside another symbol. I want all 24 to be able to set the same global variable when clicked. I can't find that this question is addressed anywhere, which makes me think I may be stuck in a Flash mindset and approaching the task in the wrong way. (There are however MANY discussions of how to address objects at different levels in the hierarchy. That's well covered.)
    Relatedly, how do you access a function on the main timeline from within a symbol?
    Adobe should consider putting together a support page (or pages) just for folks migrating form Flash. In the materials I've encountered so far there seems to be a studied effort to refrain from mentioning Flash in any way. I imagine there are a lot of people out there like me who have a deep background in Flash coding, but are just getting started with Animate. We don't need help with most of the basic concepts, but we may still have some pretty basic questions about how to accomplish some things in Animate because our Flash knowledge is getting in the way.

    Hi Bill,
    There are plenty of threads on here about scope, but here's one way to create a global variable:
    // code on Stage.compositionReady
    sym.myGlobalVar = 1;
    Then, anywhere in your project, you can check/set that var like so:
    sym.getComposition().getStage().myGlobalVar = 2;
    And here's one way to create a global function:
    // code on Stage.compositionReady
    sym.myGlobalFunction = function(){
              console.log('myGlobalFunction');
    Then, anywhere in your project, you can call that function like so:
    sym.getComposition().getStage().myGlobalFunction();

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • After updating my iphone 5 of ios 7, I delete or trash my emails rorm my inbox and they pop back up in my inbox.  How do I fix this?  They are deleted from the main server but show up in my email on my phone and will not stay deleted.

    I recently updated my iphone 5 to IOS 7 and since doing this, i cannot get my email messages to stay deleted when I trash them.  They have been deleted from the main mail server but show up on my phone.  When I trash them, they disappear for a few seconds and then re-appear in the inbox. I tried deleted my mail account from my phone and re-adding it, but this worked for about 12 hours and now its doing it again. I also have shut my phone off and rebooted it but this did not work.  How do I fix this?

    Have you tried restarting or resetting your iPhone?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after It shuts down, press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds).
    Also consider deleting and reinstalling the Mail Account in question.

  • How can I get all photos from the camera roll onto the photo stream so they will share between iphone and ipad?

    How can I get all photos from the camera roll, and all new pictures taken, to get on the photostream so they can share between iphone and ipad?

    When turning PhotoStream on with photos available in the Camera Roll, only photos captured by the iPhone or saved on the iPhone are placed in the PhotoStream.
    For all photos that were in the Camera Roll prior to turning PhotoStream on, import the photos with your computer and add the photos to your PhotoStream on your computer.

  • How do I delete a file from the Adobe Reader for iOS?

    How do I delete a file from the Adobe Reader for iOS?

    Read this:
    http://forums.adobe.com/thread/1012973?tstart=0

Maybe you are looking for