How to get to a stop and a random frame?

Hello

I have a little problem and I can't seem to find solutions.

What I want is my symbol (= "pijl1" in which there are 4 images different keys on the timeline) to show one of the keyframes, randomly, then stop.

(I'm trying to do a game like this http://www.youtube.com/watch?v=sYGJ0TRWdRM where my symbol would be one of the arrows randomly)

I did this:

import flash.events.Event;

var pijl1:pijl = new pijl();

pijl1.addEventListener (Event.ENTER_FRAME, randomdirect)

function randomdirect (event: Event) {}

var randomFrame:Number = (Math.floor (Math.random () * 4) + 1);

trace (randomFrame);

pijl1.gotoAndStop (randomFrame);

addChild (pijl1);

pijl1.x = 200

pijl1.y = 200

}

but he won't stop. It takes just to go (the output becomes crazy).

I don't know if I was clear. But if someone understands my problem, could you please help me?

PIW

Your frames loop entry constantly "replaces" your STOP function.

You can simply remove the eventlistener after the stop funtion

....

pijl1.gotoAndStop (randomFrame);

pijl1. RemoveEventListener (Event.ENTER_FRAME, randomdirect)

....

Tags: Adobe Animate

Similar Questions

  • How to get the battery level and status in the cpp file?

    Hi all

    BatteryInfo class so I can I know how to get the battery level and the State in .cpp class?

    Hi Benecore,

    I have Add method below,

    #include

    But I only variable BatteryInfoPrivate not get variable BatteryInfo. You can also check on your side.

    So let me know how to get batteryInfo instance?

  • How to get the friend list and their IDS in the integration of Facebook using Facebook SDK

    can any body send me the code
    How to get the friend list and their IDS in the integration of Facebook using Facebook SDK
    I did after connection and wall

    Welcome on the support forums.

    Please check the strawberry sample that ships with the SDK

  • How to get help in downloading and installing 12 EP and 12 first on Win 8.1?

    How to get help in downloading and installing 12 EP and 12 first on Win 8.1?

    Try using a different browser if you experience a problem for the interface to respond correctly to your interaction with it.  If you need help, preovide more information about what you feel when you tru and it fails.

    Please don't start no multiple views for the same problem - your other display information better.

  • How to get slideshow to pause and restart with AutoPlay enabled? Slideshow all does not restart!

    How to get slideshow to pause and restart with AutoPlay enabled? Is happening in all the slideshow does not restart once a picture is selected

    tytothoughts It is a very old thread, in the grand scheme of things. In the current version, you can set slideshows and compositions to restart after a while after having been suspended.

    David

    http://www.creativemuse.co

  • How to get around the stop hybrid Windows 8

    One of the novelties introduced with Windows 8's new "hybrid closing."  It is very similar to the functionality of hibernation on previous versions of Windows.  It allows a much faster start/stop time.  However, it can get there a moment where you want to completely close down your computer.  Here's how you can do it.

    1. Use the Windows + C key combination to open the bar of charms.
    2. Select "Settings" and then "Power".
    3. You will see the normal stop and restart options in question.
    4. Hold down the SHIFT key when you click on 'Stop' in this menu.
    5. Your computer will now completely stopped.

    I hope that everyone is a great day

  • How to get rid of Babylon and the Babylon toolbar

    I have installed Babylon translator.  I've uninstalled it.  But there's search page.  How can I get rid of all the bits of Babylon?

    Have you ever heard of Bing and Google?

    Very useful tools fo find how to do things.

    http://lmgtfy.com/?q=how to get rid of Babylon

  • When I pluged my camcorder (Sony trv608) in my emachine (I have windows Vista Home Basic) nothing happened.how can get video off camera and on the computer?

    (In the AutoPlay dialog box that appears when you turn on the DV camera, click importing video.)
    It's # 2 on how to import the video but when I pluged my camcorder (Sony trv608) in my emachine (I have windows Vista Home Basic), nothing is happening... How to get my video on my computer and my video cam?... I also got told by sony I needed to cap analog, so I have I need to download something on internet even thought I have Director on my windows? IM so confused?

    Hi harleykristi,

    Welcome to the Microsoft answers site!

    Looks like the video camera (Sony trv608) is not compatible with windows vista, see the Sony link below:

    http://eSupport.Sony.com/us/Perl/SWU-download.pl?upd_id=1452&MDL=CCDTRV608

    () Vista drivers are not available)

    You try to install the software that came with the device in windows XP service pack 2 compatibility mode. See the link below:

    Run the program compatibility Wizard

    1. open the program compatibility Wizard the by clicking the Start button, clicking Control Panel, click programs, and then clicking on use an older program with this version of Windows.

    2. follow the directions in the wizard.

    http://Windows.Microsoft.com/en-us/Windows-Vista/make-older-programs-run-in-this-version-of-Windows

    For more information, see the link below:

    http://eSupport.Sony.com/us/Perl/model-home.pl?MDL=CCDTRV608&loc=3

    You the best solution would be to check with Sony to learn more.

    http://eSupport.Sony.com/us/Perl/contact-land.pl?MDL=CCDTRV608

    Hope this information is helpful

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How people get viruses from Facebook and how to avoid it?

    I wondered how people get virus from Facebook, what are the best way to avoid these, and what are the symptoms of these?

    Thanks in advance.

    Welcome to the Microsoft Answers Ted site.

    The only way you can get a virus from Facebook is by clicking on a bad link. Be always careful with links on which you click, especially of foreigners who are not your friend on Facebook. If you find a link TinyURL (not a bit.ly link), copy (click the link, press Ctrl + C) then paste (click on the address bar, then press Ctrl + V), but add "Preview". (without the quotes, including the period) before the rest of the link. Then, you can see a preview of where you're going. After that, you can continue or go back.

  • upgrade from windows 7 starter edition to professional b and I want to go back to the starter, how can get on this subject and also the number of activation and the production of my Starter how do I get it?

    I updated level of windows 7 starter edition to professional but I want to go back to the starter. How do I go about it. I also want to know how can I get my product number and the activation number.

    New computers coming often pre-installed with Windows 7 have what is called a recovery partition. This is used to reinstall an operating system in the case of a system failure. To access it, you need to start when you start your computer by pressing a function key. This can be either F1, F2, F9, F10, F11, F12 key DEL or tab. See the manual that came with your PC for instructions on how to reinstall Windows.

    This is how the recovery partition is available for the most popular brands

    For Dell, press CTRL + F11 directly after switching on the device

    For HP, press F11 directly after switching on the device

    For Toshiba, press and hold "0" BEFORE and during the power upward

    For Acer, press and hold ALT + F10, as soon as you see the logo

    For Samsung: Press the F4 key to the Samsung logo when you turn first.

    For Asus, press F9, as soon as you see the Asus logo.

    Advent, restart your computer. Then, press F10 repeatedly until the message "Starting system recovery"

  • How to get to interface new and improved content WebCenter?

    How to get the user interface simple and intuitive with the convenience of drag-and-drop and sophisticated search capabilities?


    /CS in 11.1.1.8 looks the same, as it always has when I connect as a weblogic.

    You will find your answer in a previous thread: https://forums.oracle.com/message/11149975#11149975

    Roman.

  • How to get back my adjustments and masks Panel?

    I'm going by the window / PS5 class in a book and in some way, I closed it and I don't know how to get back them on the screen.  Help, please!

    Nice day!

    Window > settings

    Window > masks

    Kind regards

    Pfaffenbichler

  • How to get the outline color and size of the rectangle?

    Hi all

    I'm developing an extension for CS5 and higher (including the CC version). I want to get the outline color and size of a rectangle. I was able to do in CS5. But I noticed that in the version of the CC, there are two ways in which the user can apply to a stroke. One is by applying the effect in the layer Style, and the other through the properties panel. I am able to get the values of time in my script, if it is applied through layer Style, but I can't do it in the other scenario.

    How are these two different traits and how do I get the outline color and size if it is applied via the properties panel using script?

    Thank you!

    Here's what I have so far. It takes more work, but I don't think that's never very accurate.

    function toggleOtherLayersVisibility() {
        var desc = new ActionDescriptor();
            var list = new ActionList();
                var ref = new ActionReference();
                ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
            list.putReference( ref );
        desc.putList( charIDToTypeID('null'), list );
        desc.putBoolean( charIDToTypeID('TglO'), true );
        executeAction( charIDToTypeID('Shw '), desc, DialogModes.NO );
    };
    function liveShapeFillEnabled( enable ) {// boolean
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putEnumerated( stringIDToTypeID('contentLayer'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        desc.putReference( charIDToTypeID('null'), ref );
            var shapeDesc = new ActionDescriptor();
                var styleDesc = new ActionDescriptor();
                styleDesc.putInteger( stringIDToTypeID('strokeStyleVersion'), 2 );
                styleDesc.putBoolean( stringIDToTypeID('fillEnabled'), enable );
            shapeDesc.putObject( stringIDToTypeID('strokeStyle'), stringIDToTypeID('strokeStyle'), styleDesc );
        desc.putObject( charIDToTypeID('T   '), stringIDToTypeID('shapeStyle'), shapeDesc );
        executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
    };
    function dupeVisibleMerged() {
        var desc = new ActionDescriptor();
        desc.putBoolean( charIDToTypeID('Dplc'), true );
        executeAction( charIDToTypeID('MrgV'), desc, DialogModes.NO );
    };
    function loadTransparency(){
        var desc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );
        desc.putReference( charIDToTypeID( "null" ), ref );
            var ref1 = new ActionReference();
            ref1.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Trsp" ) );
        desc.putReference( charIDToTypeID( "T   " ), ref1 );
        executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
    };
    function getLiveShapeStrokeInfo(){
        var doc = app.activeDocument;
        var lyr = doc.activeLayer;
        liveShapeFillEnabled( false );
        toggleOtherLayersVisibility();
        doc.artLayers.add();
        dupeVisibleMerged();
        var bounds = doc.activeLayer.bounds;
        var horzCenter = (bounds[2]-bounds[0])/2;
        var vertCenter = (bounds[3]-bounds[1])/2;
        lyr.visible = false;
        var sampler = doc.colorSamplers.add([bounds[0]+UnitValue(.5,'px'),bounds[1]+vertCenter]);
        sizeObject.color = sampler.color;
        loadTransparency();
        doc.selection.select([
                                [bounds[0],bounds[1]+vertCenter],
                                [bounds[0]+horzCenter,bounds[1]+vertCenter],
                                 [bounds[0]+horzCenter,bounds[1]+vertCenter+UnitValue(1,'px')],
                                 [bounds[0]+UnitValue(1,'px'),bounds[1]+vertCenter+UnitValue(1,'px')]],SelectionType.INTERSECT);
    
        sizeObject.size = doc.selection.bounds[2]-doc.selection.bounds[0];
    };
    var sizeObject = {};
    app.activeDocument.suspendHistory('Get Live stroke info','getLiveShapeStrokeInfo()');
    executeAction( charIDToTypeID('undo'), undefined, DialogModes.NO );
    sizeObject.size;
    
  • How to get the files to and from the host

    Is there something that I can read which explains how to get the (ftp, memory stick or other) files to and from the host?

    Sorry if this is a noob question, I looked but could not find something specific...

    There are many ways of doing so:

    1 activate not supported ssh and scp use

    2. use VI Client access to your storage space on configuration files and server transfer

    3 configure the iSCSI or NAS to deal directly

  • How to get the name constraintlist and column in a table?

    Hello


    can someone please tell me how to get the type of constraint, and it is imposed on the names of columns in a table.




    Thank you
    Nico

    Hello

    Use the two tables:

    select * from all_constraints
    
    select * from ALL_CONS_COLUMNS
    

    Sorry SY, you were faster than me...

    Published by: user11268895 on August 19, 2010 13:27

Maybe you are looking for