Control of scenario main & child movieclip

Hello

This code is currently contained in my "mc_1" movieclip. I want to be able to have this code on my main timeline, but no matter what I try, I constantly errors, several different versions. I tried to add mc_1 infront of everything, but who gives just an error of output on a Sprite.

Also, I use currently visible to control if the image back to the text box should show - what I really want to do, it's control with a child, but they are movieclips no buttons, so when I try to addChild in the service it errors saying I'm trying to control a movieclip in a function of simplebutton.

----

import flash.events.MouseEvent;

Stop();

mc_textbox. Visible = false;

for (var i: uint = 1; i < 8; i ++) {}
this ["Line" + String (i)] .addEventListener (MouseEvent.ROLL_OVER, line_in, false, 0, true);
This ["Line" + String (i)] .addEventListener (MouseEvent.ROLL_OUT, line_out, false, 0, true);
}

function line_in(e:MouseEvent):void / / function like line_in Defineing
{
var lineTarget:SimpleButton = SimpleButton (e.currentTarget); The variable is lineTarget

Switch (lineTarget) / / each case must share the lineTarget
{
Line1 case: / / line 1 is the first button
line_output. Text = "1"; This text should appear
mc_textbox. Visible = true; The text box should display
break; If this isn't the case, break and then check

business line2:
line_output. Text = "2";
mc_textbox. Visible = true;
break;

line 3 cases:
line_output. Text = "3";
mc_textbox. Visible = true;
break;

case 4:
line_output. Text = "4";
mc_textbox. Visible = true;
break;

/ * This case has much more text than the rest, as such, the text box is increased for this case only
and changed position. The line_output dynamic text field is also moved on the y-axis for this.
It is reset by default using the line_out function.
*/

line5 case:
line_output. Text = "55";
line_output.y = 427.65.
mc_textbox. Visible = true;
mc_textbox. Height = 100;
mc_textbox.y = 417;
break;

Line6 business:
line_output. Text = "6";
mc_textbox. Visible = true;
break;

line7 case:
line_output. Text = "7";
mc_textbox. Visible = true;
break;

default: / / If no cases are true, this should display
line_output. Text = ""; line_output should be blank
mc_textbox. Visible = false; mc_textbox must be invisible by default
}
}

function line_out(e:MouseEvent):void
{
line_output. Text = "";
line_output.y = 474.65;
mc_textbox. Visible = false;
mc_textbox. Height = 61,95;
mc_textbox.y = 454;
}

Click on publish settings/files/flash and check "permit debugging".  Repeat the test.

the number of the line of your first mistake will be at the top of the error message.  copy and paste this error message and indicate the line of problematic code.

Tags: Adobe Animate

Similar Questions

  • strange question use stop() to control a scenario after loadClip

    Hello, I have this strange question:

    I want to control the scenario of a swf file loaded with loadClip command.

    I wrote this code

    var loader: MovieClipLoader = new MovieClipLoader();

    loader.addListener (this);

    function onLoadComplete(_mc:MovieClip) {}

    _mc. Play()

    };

    loader.loadClip (swfname, _root.holder)

    function pause() {}

    _root.holder.stop)

    }

    function pause a button is used to stop playback of the loaded movieclip.

    strange thing is that stop() works when you test the movie by the flash application and plays from the projector. It DOES NOT WORK when he runs by embed code html in swf or swf directly.

    I checked a lot of time and the name of the 'container' is resolved, but the command does not work for his screenplay.

    thanx for help

    Daniele

    you wouldn't expect this stop() never work.  Once the loading starts, stop() no longer applies to the target of a loadClip (or loadMovie) method.

    to resolve, use the stop() on the first frame of the loaded swf file editing.

  • Reference to the control on the main façade fails the Subvi front is closed?

    Hi all

    I meet a strange bug. In my code, I use a Subvi to control a piece of hardware. The Subvi has commands for all functions of my hardware.

    I changes the value of one of these controls in my main façade by running a reference to a button on my main façade in the Subvi, grabbing the value of the button with a property node, then update the value of the Subvi control using a node property signage.

    This works very well when my Subvi front is open, but does not work the Subvi front closing.

    I am new to labview, so any help is appreciated.

    Thank you

    Rachid

    This event triggers a series of writing for the real hardware. The material is sent only a command when something changes.

    My code is made up of handlers inside functional global variables. In this way, I can send different parts of code of different orders (example: reset and reset) with the events generated by programming.

    The value of the wheel of the page main itself, according to my probes, getting through. It's the Subvi button that is having a problem.

    I work under a certain pressure of time pretty important, so I managed to convince the boss that the front panel of the Subvi open does not violate the requirements of the application. I guess this has solved my isse.

  • Scenario main access to movieclip

    I want to have an order on the frame of the end of a clip to move to gotoAndPlay the second image on the main time line. How can I do?

    I tried like gotAndPlay (2), stage 1, I added and which did not. I even put a label of picture on it and it does not recognize the image tag.

    Remove the extra scene, because it only that complicates the case.

    At the end of your MovieClip writing nested:

    MovieClip(root).gotoAndPlay(2)

    or

    MovieClip(root).gotoAndPlay("framelabel")

    Replace with framelabel with the actual label you put on the framework

  • Control external SWF loaded in MovieClips

    Draw the hair a little bit today, with something that seems so easy. I have a main scenario with two empty clips (originalMC, newMC). I'm loading external swf (original.swf, new.swf) in them. Sovereign wealth funds are in the same folder as the main file. They load very well and my EventListeners trigger functions as expected.

    I need the ability to stop reading the swf external when they load, but everything I've tried to create errors or simply fails. What I have to add to the functions (stopNew and stopOriginal) to prevent them from playing? Code below. Thank you.

    Chargers for newMC and originalMC

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, stopOriginal);

    Loader.Load (new URLRequest ("original.swf"));

    originalMC.addChild (loader);

    var loader2:Loader = new Loader();

    loader2.contentLoaderInfo.addEventListener (Event.Complete, stopNew);

    loader2. Load (new URLRequest ("new.swf"));

    newMC.addChild (loader2);

    function stopNew(e:Event):void {}

    trace ("new load");

    Track works on export, so the function is called correctly

    I would like this feature to stop the chronology of 'newMC '.

    }

    function stopOriginal(e:Event):void {}

    trace ("loaded original");

    Track works on export, so the function is called correctly

    I would like this feature to stop «originalMC» chronology

    }

    Your intentions seem to be off target if you want to stop the maturities of the two elements call you newMC and originalMC.   These two objects will not be the objects that are loaded.  To stop the timelines of the new.swf and the original.swf files you load, you would use something like...

    function stopNew(e:Event):void {}

    var newSWF:MovieClip = e.target.content;

    newSWF.stop ();

    }

    function stopOriginal(e:Event):void {}

    var originalSWF:MovieClip = e.target.content;

    originalSWF.stop ();

    }

    Assuming that you want to target these movies outside of these functions, you would report the variables outside the function instead of as shown inside.

  • Have a specific return on the main timline movieclip finished image

    Hello!

    IM doin a project on the main timeline is only mounts. on the first fram ive coded for a button that directs the user to the next section. frame 2 there is an empty movieclip that is suppused to load random movieclips. the problem is when the movieclip it ends a few loops and doesent load a random.

    I have an eventlistener when the movieclip ends and then heads back to the chassis tuned for. but its framework of djemel go one so the user must press the first button again, or he comes in loop the

    I tried googleing the problem and I spent hours hours at least n change the code on n. I can also say that starting iam in actionscript.

    Here is my code:

    maintimline part 1

    Stop()

    addEventListener ("finished", child);

    function Child(e:Event):void

    {

    gotoAndPlay (e.target.frameVar);

    }

    var movieArray:Array = new Array();


    movieArray = ['bananlrdator', 'hundlrkatt', 'fisklrhand'];
    If ((movieArray [Math.floor (Math.random () * 3)]) == 'bananlrdator') {}

    myMovieClip = new bananlrdator();

    } ElseIf ((movieArray [Math.floor (Math.random () * 3)]) == 'hundlrkatt') {}

    myMovieClip = new hundlrkatt();

    } ElseIf ((movieArray [Math.floor (Math.random () * 3)]) == 'fisklrhand') {}

    myMovieClip = new fisklrhand();

    } else {}
    myMovieClip = new fisklrhand();

    }

    var myMovieClip:MovieClip;
    spelastart.addEventListener (MouseEvent.CLICK, scen2);
    function scen2(event:MouseEvent):void {}
    gotoAndPlay (2);
    Stop()

    emptyMC_mc.addChild ("myMovieClip");

    }

    This is my code in the movieclip endframe:

    var frameVar:int = 2;

    dispatchEvent (new Event ("finished", true));

    MovieClip (parent) .gotoAndPlay (2);

    Thanks in advance!

    Here's a working version of the code.  I changed it slightly to add the event listener 'finished' for the clips.  Everything at the bottom is a link to a sample file that corresponds to the code.

    Stop();

    spelastart.addEventListener (MouseEvent.CLICK, scen2);

    function scen2(event:MouseEvent):void {}
    Child();  to start things
    }

    var myMovieClip: *;

    var movieArray:Array is ['bananlrdator', 'hundlrkatt', 'fisklrhand'];.

    Shuffle (movieArray); using a function of brewing

    var indexCounter:uint = 0;

    function Child(e:Event=null):void / / null value allows to call the function without event argument
    {
    If (myMovieClip! = null) removeChild (myMovieClip); remove the current if there is a

    var ClassRef: Class = Class (getDefinitionByName (movieArray [indexCounter]));
    myMovieClip = new ClassRef();
    If (! myMovieClip.hasEventListener ("finished")) {/ / add this condition}
    myMovieClip.addEventListener ("finished", child);
    }
    addChild (myMovieClip);
    indexCounter += 1;
    if(indexCounter == movieArray.Length) indexCounter = 0; Reset the counter when all played.
    }

    function shuffle(a:Array) {}
    var p:int;
    var t: *;
    var ivar:int;

    for (ivar =. Length-1; Ivar > = 0; Ivar-) {}
    p = Math.Floor ((Ivar+1) * Math.Random ());
    t = a [ivar];
    a [ivar] = a [p];
    a [p] = t;
    }
    }

    At the last frame of each movieclip inside, I have...

    Stop();

    dispatchEvent (new Event ("finished", true));

    Here is a link to a sample file that shows it works.

    http://www.nedwebs.com/Flash/AS3_cycle_random_clips.fla

  • controlling multiple instances of a movieclip

    Hi all

    I'm new to learning Actionscript and I want to control multiple instances of the same movieclip with the same function.

    Here's what I've done so far:

    import flash.events.Event;

    declare and initialize variables

    var growthRate:Number = 2;

    var minSize:Number = 1;

    var maxSize:Number = 25;

    var scaleMode:String = 'grow ';

    Loop - add enter event listener of rectangle1_mc movie clip and call growShrink function below chassis

    rectangle1_mc.addEventListener (Event.ENTER_FRAME, growShrink);

    rectangle2_mc.addEventListener (Event.ENTER_FRAME, growShrink);

    function growShrink(e:Event):void

    {

    If (ScaleMode (ScaleMode) == 'growing up')

    {

    e.Target.Width += growthRate;

    e.Target.Height += growthRate;

    If (e.target.width > = maxSize)

    {

    scaleMode = "shrink."

    }

    }

    ElseIf (ScaleMode (ScaleMode) == "shrink")

    {

    e.Target.Width = growthRate;

    e.Target.Height = growthRate;

    If (e.target.width < = minSize)

    {

    scaleMode = "growing."

    }

    }

    }

    What is happening is that the two bodies are starting to animate then it shrinks down to nothing and the other ceases to grow. Can you please tell me what I'm doing wrong?

    Thank you

    LTA

    No, they can all share the same listener function.  but, if you want to grow and shrink independently with each other, each of them need their own ScaleMode (ScaleMode) as shown below.

    e.Target is the object that receives the mouse event.  who's going to be something on the stage of your movieclip.

    e.currentTarget is the object that has the added listener.  If there is a single shape on the stage of this object, you won't notice any difference between e.target and e.currentTarget.  But if there is more than one child, you will see a difference and e.target is almost certainly not what you want.

    import flash.events.Event;

    declare and initialize variables

    var growthRate:Number = 2;

    var minSize:Number = 1;

    var maxSize:Number = 25;

    Loop - add enter event listener of rectangle1_mc movie clip and call growShrink function below chassis

    rectangle1_mc.addEventListener (Event.ENTER_FRAME, growShrink);

    box1. ScaleMode = "Grow";

    rectangle2_mc.addEventListener (Event.ENTER_FRAME, growShrink);

    Rectangle2.ScaleMode = "Grow";

    function growShrink(e:Event):void

    {

    If (MovieClip (e.currentTarget) .scaleMode is "grow")

    {

    e.currentTarget.width += growthRate;

    e.currentTarget.height += growthRate;

    If (e.currentTarget.width > = maxSize)

    {

    MovieClip (e.currentTarget) .scaleMode = "shrinking."

    }

    }

    ElseIf (MovieClip (e.currentTarget) .scaleMode == "shrink")

    {

    e.currentTarget.width = growthRate;

    e.currentTarget.height = growthRate;

    If (e.currentTarget.width<=>

    {

    MovieClip (e.currentTarget) .scaleMode = 'grow ';

    }

    }

    }

  • Child MovieClip

    How can I go to a frame in a child of a clip through a class

    It depends on how you have your movieclip that is put in place.  If it is just sitting on the stage with an instance name "myMc", and he has a child she named "myChild", then in your main class you could put something like:

    myChild.myMc.gotoAndPlay (3);

    If you want to call from one class other than you main, you can always pass that as a parameter:

    It is an external class

    package {}

    public class secondClass extends Movieclip {}

    private var childClip:Movieclip;

    public void secondClass {}

    }

    public void passChild (mc:MovieClip}: void {})

    childClip = new Movieclip();

    childClip = mc;

    from here you can access what you want of the movieclip on the stage

    }

    and in your main class, you can pass through:

    var childHandler:secondClass = new secondClass();  Create an instance of the outer class

    secondClass.passChild (myMC);   pass the mc of the scene in class for handling

    -What are you looking for?  There is a certain ways to do

  • How to control the playback of a movieclip loaded externally

    Hi guys,.
    I'm giving this presentation now... and I am load an external swf inside a movieclip... is possible to control the playback of the swf file that is loaded outside, I want to say I want to play and make a break this swf in the main movie file... can someone please help me with it...

    Thanks in advance

    See you soon
    Hello

    Well, very easy...
    After you load the external SWF file, pause and play with the following ACE on the buttons...

    As for a break:
    on (release) {}
    _root.dropZone001.stop ();
    }

    As to read:
    on (release) {}
    _root.dropZone001.play ();
    }

    It should work no problem :)

  • Export scenario, main only one ODI?

    Hello


    I learned in the forums to move my ODI project to production, I need only export my main package/timeline.

    However, my main package calls other packages/scenarios, thus, it forces me to export these secondary scenarios for the production environment.



    Can you please confirm if I can export only the main scenario for production?
    Otherwise, I would export all scenarios and would be harder to maintain.


    Thank you

    Hello

    If your main package contains only Interfaces / Proceedures etc then its ok with just this scenario (as the main scenario contains the code of comiled), however, if you make a call to an another sub-scenario from your hand, then you must move these scenarios as well as the main (otherwise you will get error 'scenario not found')

    Hope this helps,
    Concerning
    Alastair

  • Child can disable family safety via Control Panel on the child laptop

    Summary of the issue
    Other issues of Windows Live family safety

    What version of Windows Live Family Safety do you use?
    Version 2011 (15.4.3538.513)
    Choose your operating system version:
    Windows 7

    Additional details
    Hi, my 14-year-old bought her own laptop.  I installed Windows life family safety (WLFS) and linked to his user name on the site WLFS.
    (1) first he told me he wasn't, and we discovered that Kaspersky Anti-virus is blocking define us as a reliable application and password protected for the antivirus software.  WLFS SHOULD ALERT PARENTS TO THIS POTENTIAL SECURITY BREACH.
    (2) then he told me that he could disable the parental control via the control panel: > Panel > user accounts and Family Safety > Parental control > provider Elite > [click here] 'None' versus "WLFS." WLFS SHOULD ALERT PARENTS TO THIS POTENTIAL SECURITY BREACH.
    This is alarming!   What is the best way to solve this problem?  Shouldn't Microsoft remove this feature from the control panel or password protect or something?   Is there another solution besides me being an administrator on his laptop?  How he would be able to make changes on their own computer if I did?   We are very angry;  WLFS has worked great for us so far!  Help, please!

    Thank you for taking your time!  In fact, we have been successfully in Kaspersky parental control for him.  He is now 15.  WLFS program works very well for my 10 years, who doesn't know much about computers and has never entered a "Control Panel" of his own volition and don't know what to do when she got in there!  My son has another question: had taken programming and is autonomous led to learn more about computers.

    Last year, he bought his own SERVER to run its multi-player online game!

    Thanks again,
    QueenofArts

  • How to click a clip from movie and control the scenario of the clip another?

    Code on the main timeline in Adobe animate:

    This.Stop ();

    createjs. Touch.Enable (internship);

    this.clipOne.on ("click", function() {}

    clipTwo.gotoAndPlay ("AnotherFrameLocation");

    });

    Just trying to figure the right scope to manipulate the other clips.  Basically, click on the clip it and move to another frame clip two.

    Any help would be appreciated.

    I would like to have the separate function, to make it a little easier to read. clipOne and clipTwo are the two children of the first 'this', but once you are inside a function 'this' becomes the function itself. If you set a variable to remember of the parent. This would work:

    var self = this;

    this.clipOne.on ("click", advanceTwo);

    function advanceTwo() {}

    self.clipTwo.gotoAndPlay ("AnotherLocation :);

    }

  • Tween alpha in the scenario main no interpolation

    Hey guys

    I'm trying to do something relatively simple... in theory.

    I have a clip on the main timeline I want to tween alpha from 100% to 0% on 8 frames. Now, if I use the Tween AS class, it does exactly that, no problem with that.

    However, if I try to do the interpolation using the timeline, is any tween, it does not even recognize the alpha property to the keyframe, it just stays at 100%.

    I don't want to use AS interpolation because it is running on a specific material which does not lend itself what although that runs using a timer.

    What could be the problem here?

    See you soon

    I found the problem - the clip is positioned by the user entering positions X and Y in an XML file, and when the position has been set it seems to collide with the interpolation of chronology - by removing the location code is interpolation of work very well.

    I end up using the interpolation of ACEs, it's just that we use very, very specialized equipment and there is no precedent for LIKE used interpolation, we try to lighten the load on the processor as possible. Fortunately, it works without any problem.

  • Image of child movieclip on frame later Goto

    Hi, I tried to find a tutorial or a description on how to do it.  Sorry if I ask something repetitive, but I can't seem to find the right way to seek or find something that explains it.

    What I'm trying to do is btn1 click mc1 Timeline frame 1 which will be goto and play mc1 Timeline frame 30 where the mc2 child is, then plays mc2 to frame 10.

    I know that this will not work as mc2 exist til frame 30 but to give an idea

    Btn1.addEventListener (MouseEvent.MOUSE_UP, release1);

    function release1(evt:MouseEvent):void {}

    this.gotoAndPlay (30) .mc2 (10);

    }

    kind of like how you can go to an image tag in a scene

    mc1.gotoAndPlay("intro", "Scene 12");

    From what I have gathered so far, it's use integers?

    Thanks for any help.

    use:

    Btn1.addEventListener (MouseEvent.MOUSE_UP, release1);

    function release1(evt:MouseEvent):void {}

    this.addEventListener (Event.RENDER, renderF);

    internship. Invalidate();

    this.gotoAndPlay (30);

    }

    function renderF(e:Event):void {}

    this.removeEventListener (Event.RENDER, renderF);

    MC2.gotoAndPlay (10);

    }

  • How to access info child movieclip to an object in a table?

    Hello

    I created a whole bunch of clips dynamically.

    I gave a name based on a variable number to each item:

    MC. Name = "mc" + i;

    I also use addChild to add some dynamic text fields to each movieClip and named myText1 myText2.

    Then I push each movieClip object in a table:

    myArray.push (mc);

    When I have the movieClips addChild, they display fine, complete with each textField.  And if I use the following loop to find the name of each element of the array, I get:

    for (var i = 0; i < myArray.length; i ++)

    {

    trace (myArray [i]. (Name)

    }

    output:

    MC1

    MC2

    MC3

    MC4

    etc.

    What I want now is to be able to access text fields in each movieclip in the table.  However, I get errors when I try in different ways.  For example:

    for (var i = 0; i < myArray.length; i ++)

    {

    trace (myArray [i].myText1.Text);

    }

    gives error: a term is undefined and has no properties.

    How to access the values and the content of the children of the movieClip objects that are stored in the tables?

    Thank you

    Shaun

    For some reason, dynamically added children cannot be targeted like that.  If you have added the textfields dynamically, you may need to use the getChildByName() target.  It depends in part on how you created and whether or not you have direct access to them.  Aside from that, you can also assign the textfields to the variables that you create for the mc and target those who by their names of variables.

    These two approaches demos the following:

    var mc:MovieClip = new MovieClip();
    addChild (mc);

    var tf:TextField = new TextField();
    TF. Text = "this is the text";
    mc.addChild (tf);

    first way

    TF. Name = "tfield."
    trace (TextField (MC.getChildByName ("TField")). (Text);

    second way

    MC.tfid = tf;
    trace (MC.tfid.Text);

    You can also store the textfields in the tables are created and they have direct access to them with the need to target the mc... the index must be the same as the one you use for the mc anyway.

Maybe you are looking for

  • iMac 21.5 material several bugs

    My imac 21.5 (medium model 2010) suddendly started showing several hardware problems in just a few months. First of all, the DVD player, then the hard drive HD and video card now broken. I have invested a lot of money, time and lost all information.

  • How to remove my password to start connection using imac OSX EL Capitan 10.11.2

    How to remove my password to start using IMac OSX EL Capitan 10.11.2 connection

  • Cannot install Photosmart C6380

    Photosmart C6380 all-in-One installed the printer almost all the way to the wired network. Then, he fails to finish. I've even set up 100%, then get a fatal error. I uninstalled the software, rebooted the computer, reset the printer and that she fail

  • There is no disk space

    Hello world I use Win Server 2008 We have 3 NAS drives in the server. I can copy all the files to two hard drives. But in one reader I can't copy files to that. When I tried to copy the file I get an error "There is not enough space to complete the o

  • How can I activate dark reign 2?

    As you may know, Pandemic Studios is dead; for this reason, I can not activate my copy of dark reign 2. could someone help me or advise me on how to make it work?