How do I create a Sequence using Actionscript?

Suppose I've got 2 movie clips on the stage. box_mc and triangle_mc
I want to set up a way so that whenever I trigger the event, such as pressing a key (like
if(Key.isDown(Key.SPACE)){
//stuff that activates it
it does the following in order, spaced by 1 frame, or 1 second (or a specific number of frames)
[1] box_mc._rotation = -45;
[2]triangle_mc._rotation = 45;
[3]box_mc._rotation = 0;
[4]triangle_mc._rotation = 0;
if I push the Space key again, it would start from the top (1) and repeat the sequence. The sequence would otherwise stop at 4. Previously I've been using counters inside an onEnterFrame such as counter = counter +1; if counter > n, counter = n; etc. This seems tedious and I'm hoping there's a better way to do this. I do not understand watch and timer functions of actionscript (they never seem to work for whatever project I'm occupied with).
Thanks!

it definitely worked this time. I edited it for gear appearances and it looks ok:
function startSequenceF(){
rotateF(box_mc,-45);
clearTimeout(rotate1I);
clearTimeout(rotate2I);
clearTimeout(rotate3I);
clearTimeout(rotate4I);
clearTimeout(rotate5I);
clearTimeout(rotate6I);
clearTimeout(rotate7I);
rotate1I=setTimeout(rotateF,200,box_mc.triangle_mc,30)
rotate2I=setTimeout(rotateF,400,box_mc,-90);
rotate3I=setTimeout(rotateF,600,box_mc.triangle_mc,60);
rotate4I=setTimeout(rotateF,800,box_mc,-135);
rotate5I=setTimeout(rotateF,1000,box_mc.triangle_mc,90);
rotate6I=setTimeout(rotateF,1200,box_mc,-180);
rotate7I=setTimeout(rotateF,1400,box_mc.triangle_mc,0);
function rotateF(mc:MovieClip,angle:Number){
mc._rotation = angle;  // or animate this
// and to start everything going use:
onEnterFrame = function(){
    if(Key.isDown(Key.SPACE)){
startSequenceF();
my next question would probably be "How can I make these changes more graceful/fluid", or would I have to make several minute changes of a few degrees each?

Similar Messages

  • How to create a sequence using Toplink for DUAL table

    Hi All,
    How do I create below sequence using TOPLINK
    CREATE sequence my_seq start WITH 1;
    Regards,
    Dheeraj

    Hi Dheeraj,
    Sequence Object should be created in Database and specify the type of sequence that will be used in toplink to create sequence value.For example,sequence objects created in database needs to be configured using Native Sequence.
    For more information refer to the below link.Use JDeveloper Toplink Wizards for declarative programming of Toplink native Sequencing.
    http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/reldscfg003.htm.
    Regards,
    P.Vinay Kumar

  • How do I create a submenu using Muse

    How do I create a submenu using muse

    Hi,
    Kindly refer to the following links:
    Vertical Sub Menu
    Adobe Muse - Submenu - Sub Menu - Drop Down Menu - Navigation - YouTube
    Adobe Muse Getting Started - Adding A Navigation Bar - YouTube
    Regards
    Sonam

  • How Do I create a Ringtone Using an mp3??

    Hi
    As the topic suggest. How do I create a ringtone using a mp3 instead of buying ringtones from iTunes?
    Thanks
    Baz

    madgroundhog wrote:
    I've tried this method, but it's still not working for me, for some reason. I've got the 3GS. I followed the instructions, and the created ringtone is showing up in iTunes in the Ringtone section. When I connect my iPhone to my Mac, & it appears as a device in iTunes, my ringtone appears there... it just doesn't appear under the ringtone options on the iPhone itself... what am I doing wrong here? Am I looking for it in the wrong place?
    Make sure to sync your ring tones.

  • How can i create splash screen using netbean?

    how can i create splash screen using netbean?

    Welcome to the Sun forums.
    gabbyndu wrote:
    how can i create splash screen..Java 6 offers a splashscreen functionality. See [New Splash-Screen Functionality in Java SE 6|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/] *(<- link)* for details.
    [Java Web Start|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp] has offered splash screens to applications since Java 1.2. See [How can I provide my own splash screen?|http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq.html#206] in the JWS FAQ for more details.
    .. using netbean?We don't support Netbeans here. Ask that on a [Netbeans forum|http://forums.netbeans.org/].

  • How can i create slaes order using BAPI

    hi all,
    i didnt work on BAPIS .how can i create sales order using BAPI here i should pass Z values.
    Moderator message : FAQ, search for available information. Thread locked.
    Edited by: Vinod Kumar on Sep 13, 2011 12:22 PM

    Hi!
    There are a lot of answered threads regarding your question. Try searching first. Below is a sample link.
    BAPI_SALESORDER_CREATEFROMDAT2
    Regards,
    Steph
    Edited by: stephquion on Sep 13, 2011 8:25 AM

  • How do we create a vendor using portal?

    how do we create a vendor using portal.
    creation process needs to trigger workflow.
    Sonali

    You need to use WLST online. I am not sure what your exact requirements are but one good way of working this is to have a WLST script that deletes all your WL customisations, like connection pools, JMS Servers etc and then creates it. That way you can run the same script repeatedly and it will get everything up to date for you. However you have to remember that everytime you add something new you need to update your delete section. Also your deleting should not fail if the item does not exist. I hope that makes sense!
    As to the specifics of WLST examples to do this then check out the WLST examples in CodeShare.
    If you are still having issues then post another message.
    Geoff

  • How can I create DVD Label using Photoshop Elements 10?

    How can I create DVD label using Photoshop Elements 10?
    Richard

    You can create the design for a DVD label in Create>More Options. Once you have the label set up, you would copy it to a template for the labels you plan to use. (The PSE template makes one label, while most printed labels are two-up.)

  • How do you create a sequence number in SQL Developer Data Modeler?

    I am new to Data Modeler and am looking to create a sequence number but do not know how to do the same using the Data Modeler. Can someone guide me? Thanks.
    Edited by: user6710206 on Jun 9, 2010 7:32 AM

    I have had found that the following works sometimes when coming immediately after the create or replace package body in a script (although it isn't doing anything for me on invalid package bodies at the moment):
    show errors package body <package name>
    Because it is inconsistent, you cannot really trust it, which gets you back to Jim's options (open in editor or compile from connection tree) or the old long hand of
    select * from user_errors where type = 'PACKAGE BODY' and name = '<package name>'

  • [Forum FAQ] How do I create calculated measure using AMO in SQL Server Analysis Services?

    Introduction
    In SQL Server Analysis Services (SSAS), you can create a calculated measure in SQL Server Data Tool (SSDT)/Boniness Integrated Development Studio (BIDS). Sometimes you may need to create calculated measure by using AMO in a C# or VB project.
    In this article, I will demonstrate so how to create calculated measure using AMO in SSAS?
    Prerequisites
    Before create calculated measure using AMO, you need to ensure that the following components were installed in your server.
    The multidimensional database AdventureWorks Multidimensional Model 2012
    A SQL Server with SSIS and SSAS installed
    The AMO libraries installed:
    X86 Package (SQL_AS_AMO.msi)
    X64 Package (SQL_AS_AMO.msi)
    Solution
    Here is the detail steps to create calculated measure using AMO in SSAS.
    Open SSDT and create a new SSIS project.
    Drag Script Task to the design surface.
    Click SSIS-> Variables to open the Variables window and add two variables that used to connect to the server and database.
    Create a connection to connect to SSAS server.
    Rename the connection name to ssas.
    Double click the Script Task to open Script Task Editor.
    Add Connection and Database variables to ReadWriteVariables textbox and then click Edit Script button.
    Add AMO reference in the Solution Explore window.
    Copy the script below and paste it into the script.
    Dim objServer As Server
    Dim objDatabase As Database
    Dim strDataBaseID As String
    Dim objCube As Cube
    Dim objMdxScript As MdxScript
    Dim objCommand As Command
    Dim strCommand As String
    objServer = New Server
    objServer.Connect("localhost")
    objDatabase = objServer.Databases("AdventureWorksDW2012Multidimensional-EE2")
    strDataBaseID = objDatabase.ID
    If objDatabase.Cubes.Count > 0 Then
    objCube = objDatabase.Cubes("Adventure Works")
    If objCube.MdxScripts.Count > 0 Then
    objMdxScript = objCube.MdxScripts("MdxScript")
    objMdxScript = objCube.MdxScripts(0)
    Else
    objCube.MdxScripts.Add("MdxScript", "MdxScript")
    objMdxScript = objCube.MdxScripts("MdxScript")
    End If
    objCommand = New Command
    strCommand = "CREATE MEMBER CURRENTCUBE.[Measures].[Multipy Measures By 3]"
    strCommand = strCommand & " AS [Measures].[Internet Sales Amount] * 3, "
    strCommand = strCommand & " VISIBLE = 1 ; "
    objCommand.Text = strCommand
    objMdxScript.Commands.Add(objCommand)
    objMdxScript.Update()
    objCube.Update()
    End If
    objServer.Disconnect()
    Then you can run this SSIS package to create the calculated measure.
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How can I create an iBook using iBooks Author using images from a PDF?

    I have a complex book with custom fonts and lots of images, and the client wants it on the iPad. So my most reasonable option seems to be to take images from a PDF and use them for the pages. However, images in iBook Author don't get "laid out" as expected in Portrait mode. How can I  create a layout that is essentially one image per page in portrait mode, and then convert that to landscape mode? Or is there an easier way to go about this?

    tk0us wrote:
    Make sure you have disabled portrait in the Inspector.
    I don't understand why portrait mode defaults images and other "widgets" to thumbnails. The original format of the book (and of 99% of all books I'm guessing) is in portrait format. By forcing the book to work only in landscape mode it's forcing the page image to be half the size, and that makes using this book particularly difficult. Is there no way to force the pages to be full-size in portrait mode?

  • How do I create a journal using iPhoto 11 on a mac?

    Any idea how I can create an iphoto journal on my mac like I can do when using iphoto on my phone or ipad? I can't seem to make a Journal from my Mac using iPhoto 11.

    That is not a feature of iPhoto on the Mac  - it is only available on iPhoto for IOS - suggest to Apple - iPhoto Menu ==> provide iPhoto feedback.
    LN

  • Can i create a sequence using java?

    Hi,
    I have a problem here.
    I have to update records to my oracle9i database.
    One of the fields in my tables has to be auto number, meaning whenever i add records to this table, this fields will automatically be updated jus like a counter.
    I am told that i could do this by writing a sequence. can any1 help me out?
    Thanks a million!

    To create a sequence in Oracle you can use this (with SCHEMA being replaced by whatever Schema that you are adding the Sequence to)...
    CREATE SEQUENCE SCHEMA.SEQUENCEGENERATOR
    START WITH 1 INCREMENT BY 1 MINVALUE 1 CACHE 20 NOCYCLE NOORDER ;
    From a stored procedure or java code you could
    then use the following to get the next available number
    SELECT SEQUENCEGENERATOR.nextval INTO v_record_id from dual;
    This may or may not work for your needs. Everytime the Select statement is executed a number will be "used". As an alternative you could use something like .... Select Max(number) from Table (this could be table that contains your "auto number" or a seperate support table.

  • How can we create info record using IDOC INFREC?

    Hi Friends,
    Can we create info record using IDOC INFREC. If Yes. How?
    Regards,
    Narendra

    Using IDOC INFREC & FM IDOC_INBOUND_SINGLE

  • How can I create a widget using a visual different from its parent?

    Hi All:
    I have a 8-bit-depth shell widget, how can I create a child widget using 24-bit-depth visual, the child is a XmDrawingArea. I cannot set XmNvisual.
    But why GLwCreateMDrawingArea() can?
    Thanks?

    Move your formulas in a non header column.
    In the cell A2 of the table "aux", the formula is :
    =IF(ISBLANK(main :: A2),"",main :: A2)
    then I applied Fill Down.
    Yvan KOENIG (VALLAURIS, France) mardi 2 août 2011 15:07:54
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Maybe you are looking for

  • Itunes v12.1 and iphone 3gs

    I can't sync to my iphone even after 2 hours. Is there a button for sync? I have tried point and place - no result. My iPhone is old but it has so much music I ask myself how did it get there then? nof 28/2/15

  • Display a progress indicator in the jsp

    Hi to all; Once more i need your help. I have built a website that can connect insert and retrieve data into and from any database. My problem is that, since some of the insert operations take long to complete, I would like a pop up progress indicato

  • Inbound IDOC - for Orders Acknowledgement & Orders change Acknowledgement

    Hi Gurus, Using EDI 855 and 865 need to change delivery date and delivery quantity. The quantities must be equal to the original PO quantities. PO quantity must be splitted to equal the original PO quantity and we need to post the acknowledgements in

  • How to upload a tutorial in wiki

    hi i'm trying to upload a tutorial in wiki for that i'm clicking Add page button and than using code tutorial template.In that i'm copying the tutorial but the images are not getting copied. So how to add images in that code tutorial.

  • Will only show the apple logo thats it I can do noithing else

    my ipod only shows the apple logo and willl not do anything else how do i fix it?