How to create delay before tween or function in AS?

Hi there
I have a number of cases where I have a tween happening in ActionScript, but I would like it to happen after a delay from the event that triggers it. At the moment I'm creating this delay by having a tween that does nothing (eg. an "_x" tween for which the start and end points are the same) and then using tween1.onMotionFinished = function(){… to create the one I really want.
Is there a way to create this delay more neatly? At the moment what I am doing works fine, but it's still a workaround and if there's a better way to do it I'd like to learn. It'll probably help me out in the long term.
I'm using AS2 in CS3.
Thanks!

Try using setInterval

Similar Messages

  • Put Delay Before 'return' in Function

    When I create function that allow flash to detect object's velocity, a problem happen. I can't put delay before 'return' executed. It's cause result of function is null or 0. There's the script:
    function SSvelocity(Target:Object,target_property:String,delay_ms:int=1000):Number
         if ((target_property!="x")&&(target_property!="y")&&(target_property!="z")&&(target_property!="rotation"))
              trace("ShortenScript: err(SSvelocity[1]): SSvelocity("+Target+","+target_property+","+delay_ms+")");
              trace("                                   SSvelocity(the_object,target_property,delay_millisecond)");
              trace("                                   position should filled with \"x\" or \"y\" or \"z\" or \"rotation\"");
              trace("                                   and don\'t forget about quotes(\")");
              DisplayError = true;
              return null;
         var detecta:Timer = new Timer(1000);
         var detectb:Timer = new Timer(1000);
         var resulta:Number;
         var resultb:Number;
         detecta.delay = delay_ms;
         detectb.delay = delay_ms;
         detecta.start();
         detecta.addEventListener(TimerEvent.TIMER, handlera);
         detectb.addEventListener(TimerEvent.TIMER, handlerb);
         function handlera(event:TimerEvent)
              detecta.stop();
              if (target_property == "x")
                   resulta = Target.x;
              else if (target_property=="y")
                   resulta = Target.y;
              else if (target_property=="z")
                   resulta = Target.z;
              else if (target_property=="rotation")
                   resulta = Target.rotation;
              detectb.start();
         function handlerb(event:TimerEvent)
              detectb.stop();
              if (target_property == "x")
                   resultb = Target.x;
              else if (target_property=="y")
                   resultb = Target.y;
              else if (target_property=="z")
                   resultb = Target.z;
              else if (target_property=="rotation")
                   resultb = Target.rotation;
         // I want put delay before return, because it's resulting NaN and often 0
         return (resultb-resulta);

    I agree with Ned that you should rethink your approach. Objects A and B are your Information Experts (GRASP (object-oriented design) - Wikipedia, the free encyclopedia) on the problem at hand, so they should be responsible for storing their own previous positions and calculating velocity.
    Let's assume that it's possible for you to apply the same Base Class to both A and B. That Base Class might look something like this:
    public class VelocityClip extends MovieClip {
         //each history will contain the past 10 values for that property
         protected var propertiesHistory:Dictionary = new Dictionary();
         //by adding or removing property names to this Array, you can change what properties are being tracked
         protected var trackedProperties:Array = ['x', 'y', 'rotation'];
         //capture values every 100 ms (10 times a sec)
         protected var timer:Timer = new Timer(100);
         public function VelocityClip() {
              super();
              for each (var property:String in trackedProperties) {
                   //create a spot to store the history of each tracked property
                   propertiesHistory[property] = new Vector.<Number>();
              timer.addEventListener(TimerEvent.TIMER, storeValues);
              timer.start();
         protected function storeValues(e:TimerEvent):void {
              for each (var property:String in properties) {
                   var history:Vector.<Number> = propertiesHistory[property] as Vector<Number>;
                   if (history.length > 9) {
                        //stay at 10 total indices by removing first item
                        history.shift();
                   history.push(Number(this[property]));
         public function getVelocity(property:String):Number {
              var history:Vector.<Number> = propertiesHistory[property] as Vector<Number>;
              if (!history) return NaN;//no history for this property
              if (history.length < 10) return 0; //haven't been moving for a full sec.
              //history[9] was recorded sometime in the last 99 ms, and history[9] and history[0] are 1 sec apart
              //subject to the limitations of the Timer Class
              return history[9] - history[0];

  • How to Create a new Number Range Function in R3

    Hi,
    I need to create a new number range function in R3 and i have to call this function to get the new material number incremented by 1. Can any one please let me know the transaction code to create the number range function? Please also tell me how to call this number range function in ABAP pogram? Thanks for your help  in advance.
    Thanks and Regards,
    Kannan

    Hi,
    Go to snro
    create an object say zabc
    specify short text and long text and
    number length domain say num10
    then click number range interval at the top and specify starting and ending number.The number you want
    for ex
    from number 5700000000
    to number   6799999999
    make sure i should be no of digits in specify in previous .
    Then you use this object i.e zabc where ever you want
    for ex
       call function 'NUMBER_GET_NEXT'
                  exporting
                  nr_range_nr                   = '01'
                  object                        = <b>'ZABC'</b>
                  quantity                      = '1'
           SUBOBJECT                     = ' '
           TOYEAR                        = '0000'
           IGNORE_BUFFER                 = ' '
             importing
             number                        = number
           QUANTITY                      =
           RETURNCODE                    =
             exceptions
               interval_not_found          = 1
               number_range_not_intern     = 2
               object_not_found            = 3
               quantity_is_0               = 4
               quantity_is_not_1           = 5
               interval_overflow           = 6
               others                      = 7

  • How to create a generic datasource from function module?

    Dear experts,
    I have created a generic datasource from function module. For this extrator, I created a function module and a structure.
    I have now some difficulties to continue:
    In this function module, i get data from different transparent tables. Then i put these data into an internal table.
    I just don't know what is the relatioin between the structure i defined and this internal table.
    I should make "iTab structure AA" in the source code?
    Thanks

    Hi..
    check this
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    1. Create s structure with the fields that you need from the 4 tables . Activate.
    2. Goto SE 80 Select The Function Group , Copy , Select the Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. SE37 ->Your Function module name -> Change , In table tab give your structure
    name by deleting the associated type given in " XXXX " .
    4. Now select source code and Do the coding . Give Data source name in Coding .
    In your case you have to take data from more that 1 table .
    5. Activate the Function Group .
    6. In RSO2 Create the Data source , Give the Function Module Name , And Save.
    7. RSA3 -> Give data source name and Check for the Records .
    Creation of custom datasource. (Using function module)
    .Create a function group .
    . Structure ZTXXXX
    Create function module (i.e. ZTESTXXX) .
    . Create the data source using transaction (RSO2).
    . If structure exists for the table parameter of your function module then ok else create a structure for the table parameter ‘        ’.
    Test the datasource in R/3 using transaction RSA3.
    Transfer the data source to BW –System and replicate it in the BW-System.
    Message was edited by:
            shiv

  • How to create a new request for function group?

    Hi Friends,
    My client has changed their development server. Now all the objects in old DEV server are transfered to new one. Except for function group objects, we have created new change request number for all others. Now I need to create a new request for function group objects. Can anyone suggest which transaction code I have to use for this purpose?
    Thanks,
    Kaarthick.V

    Hi Karthick,
    If you want to Change the request for your FG means,
    1. Go to SE80 ->  work bench ->  Edit object.
    Here you have the option two change the request.
    or If you want to create the Function Group means,
    Go to SE80 -> Select Function Group -> Enter name -> press Enter
    Thanks,
    Reward If Helpful.

  • How to create scripts that perform these functions?

    Hi Apple people
    I got Mach Desktop because I saw this screenshot:
    But it turns out that you have to create scripts/Shell scripts yourself. Googled it, and all that shows up is their website with "sample" Desklets that are tiny grey windows with words in them.
    So can somebody please tell me how to create the battery percentage script, the weather, & the date?
    Thanks so much!

    Battery Percentage:
    pmset -g batt
    Weather, replace the following POSTALCODE&u=f with your postal code in the example on Mach Desktop wed site. Hmm, if you want to know if it's raining of the President then:
    curl --silent "http://xml.weather.yahoo.com/forecastrss?p=20500" | \
    grep -E '(Current Conditions:|F<BR)' | \
    sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'
    The date is very easy:
    date

  • How to create a f4 help using function module.

    Hi,
        I want to create an f4 help with out using match code objects.How can i do it ? . Is there  any function code for it ?.

    Hi,
    Please search on SCN before posting...
    Refer FM F4IF_INT_TABLE_VALUE_REQUEST
    Refer this demo code to get a S.help for BELNR based on user input for BUKRS:-
    PARAMETERS : p_belnr TYPE belnr,
                 p_bukrs TYPE bukrs.
    DATA : BEGIN OF itab OCCURS 0,
             belnr TYPE belnr,
           END OF itab.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_belnr.
      PERFORM f4_belnr_help USING p_belnr.
    *&      Form  f4_belnr_help
    *       text
    *      -->P_BELNR text
    FORM f4_belnr_help USING p_belnr.
      DATA : itab TYPE STANDARD TABLE OF it WITH HEADER LINE,
             tb_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE,
             v_bukrs TYPE bukrs.
      CLEAR:   tb_dynpfields.
      REFRESH: tb_dynpfields.
      MOVE 'P_BUKRS' TO tb_dynpfields-fieldname.
      APPEND tb_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname                               = 'Z_F4' "program name
          dynumb                               = '1000' "screen number
        TABLES
          dynpfields                           = tb_dynpfields
        EXCEPTIONS
          INVALID_ABAPWORKAREA                 = 1
          INVALID_DYNPROFIELD                  = 2
          INVALID_DYNPRONAME                   = 3
          INVALID_DYNPRONUMMER                 = 4
          INVALID_REQUEST                      = 5
          NO_FIELDDESCRIPTION                  = 6
          INVALID_PARAMETER                    = 7
          UNDEFIND_ERROR                       = 8
          DOUBLE_CONVERSION                    = 9
          STEPL_NOT_FOUND                      = 10
          OTHERS                               = 11.
      IF sy-subrc  0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE tb_dynpfields INDEX 1.
      IF sy-subrc EQ 0.
        v_bukrs = tb_dynpfields-fieldvalue.
      ENDIF.
      SELECT belnr from <db_table> INTO TABLE itab WHERE bukrs = v_bukrs.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield               = 'BELNR' "internal table field
          dynpprog               = 'Z_F4' "program name
          dynpnr                 = '1000' "screen number
          dynprofield            = 'P_BELNR' "screen field name
          value_org              = 'S'
        TABLES
          value_tab              = itab "internal table
        EXCEPTIONS
          PARAMETER_ERROR        = 1
          NO_VALUES_FOUND        = 2
          OTHERS                 = 3.
      IF sy-subrc  0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " f4_belnr_help
    Hope this helps you.
    Regards,
    Tarun
    Edited by: Tarun Gambhir on Mar 26, 2009 11:29 AM

  • How to create a dynamic multi-line function in SQL Server

    I am attempting to create a Multi-Line Function in SQL Server that accepts a dynamic WHERE clause as a parameter. I need this so that the function can be as versatile as possible for the filter that needs to be applied. I am unfortunately getting an error
    upon creation of the function.  I don't know how to solve the problem. Can someone advise me?
    SQL:
    SET
    ANSI_NULLSON
    GO
    SET
    QUOTED_IDENTIFIERON
    GO
    -- =============================================
    -- Author:
    -- Create date: 2/3/2014
    -- Description: This multiline function will accept a generic WHERE Clause and apply it to the query for return.
    -- =============================================
    CREATE
    FUNCTIONTESTMULTILINEFUNCTION
    @WHEREvarchar(1024)
    ,@CHANGEDDATEasdatetime
    RETURNS
    @TESTTABLE
    TABLE
    IDint
    ,REVint
    AS
    BEGIN
    Declare@SQLSTRINGvarchar(4096)
    SET@SQLSTRING=''
    SET@SQLSTRING=@SQLSTRING+'SELECT
    REVS.ID, REVS.Revision
    FROM
    Select distinct result.ID, Max(Rev) as ''''Revision''''
    FROM
    Select * from dbo.BugsAll
    where
    [Changed Date] < @CHANGEDDATE
    ) result
    GROUP BY result.ID
    ) REVS
    join dbo.BugsAll BA on (BA.ID=REVS.ID AND BA.REV=REVS.revision)'
    IF
    (@WHEREisnotnullOR@WHERE<>'')
    BEGIN
    SET@SQLSTRING=@SQLSTRING+'
    WHERE '+@WHERE;
    END
    INSERT@TESTTABLE
    EXEC
    (@SQLSTRING)
    RETURN
    END
    GO
    ERROR:
    Msg 443, Level 16, State 14, Procedure TESTMULTILINEFUNCTION, Line 44
    Invalid use of a side-effecting operator 'INSERT EXEC' within a function.
    Senior Test Lead -- Microsoft

    >> Unfortunately I really need to form a dynamic query in a table valued function on the SQL SERVER. I have another tabled valued function that needs something returned as a table in order to further join the data. I am not allowed to use Stored
    Procedures in that function. <<
    You do know that real SQL programmers hate the proprietary nightmare of tabled valued functions?  This is how you procedural programmers avoid learning set-oriented declarative and functional programming. 
    Your mindset wants to write to a scratch tape or disk file (aka “tabled valued function result table”) just like you did BASIC, FORTRAN or COBOL. QL programmers do not have to materialize their data. We can use VIEW or a drive table as well as a base table. 
    >> Plus, there are occasions where I don't want to pass in a field [sic: columns are not fields] parameter or need to change a parameter list such that I don't wish the table function to filter by a particular field [sic] or other setting. <<
    What you want is a magical “Automobiles, Squids and Lady Gaga” function. An SQL programmer might write a complex VIEW then do simpler SELECTs off it. 
    >> My application pushes the WHERE clause from EXCEL to SQL to do the hard work as EXCEL is not the application in which I want to process the SQL statement and pass it via ODBC. I cannot run macros in Excel on the web.<< 
    This is a crazy language system. Usually we fetch data in SQL and then pass it to a math package, report writer, etc. We never keep logic (aka WHERE clauses) outside the database. 
    >> I am bummed about the fact that this feature doesn't work. It will up my server management costs to maintain unique tabular based functions based on WHERE clause query <<
    So stop writing those “tabular based functions”, change your mindset and start learning SQL and do it right. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to create an app with this function?

    Hi, people. Total beginner here.
    How can I create an application that auto-generates instantly downloadable PDF files with contents based on whatever the user chooses to click on or type on the front-end interface. I saw such Flash app before on a Facebook Page so I kinda believe it's possible.
    Any help would be appreciated. Thanks!

    you can try using an actionscript class like purePDF (http://www.sephiroth.it/weblog/archives/2010/02/purepdf_a_complete_actionscript_pdf_l.php) or use server-side code like fpdf (www.fpdf.org).

  • Creating delay before navigating to another page

    All,
    i am trying to create a popup with loading image on a page such that if you load this page the "loading... image in small div is displayed like for few 2-3  seconds then the page automatically navigates to another page and pass one parameter value.
    here is what i did:
    1. added a popup div in my page header and within iam referencig <img src=#WORKSPACE_IMAGES#loading.gif />    this works correct when the pages loads
    2. created DA to submit the "NEXT" button,
    the problem is that #2 is firing so fast before the iamge is loaded or seen,
    so how to make changes so #1 runs for 2-3 secs then #2 executes to go to target page  ?
    apex 4.2,
    thanks.

    Hi,
    I use the jQuery plugin called blockUI (jQuery BlockUI Plugin)
    It basically blocks and darkens the screen (and shows a "loading" animated gif) while the next page is loaded and prevent users from accidentally double-clicking any buttons.
    Or from further interacting with the page when they shouldn't be,
    eg the IE progress bar is located at the bottom of the page and not plainly visible.
    The other benefit is that it actually informs the user than something is happening, rather than staring at a "stuck" screen.
    Hope this helps.
    David

  • How to create textsymbols by using satndard function module?

    Hi.
    Guru's.
    There is a report in which at first i can read textpool of a another program through standard function module  ( RS_TEXTPOOL_READ  /  BX_AGR_READ_TEXTPOOL  ) and i don't know  how to insert textsymbols into the textpool after reading through standard function module.
    shabeer ahmed.

    Hi,
    Please check this link..
    http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db9bf494511d182b70000e829fbfe/frameset.htm
    Hope this would help you.
    Good luck
    Narin

  • HOW TO CREATE A GLOBAL USER DEFINED FUNCTION

    Hi Expert,
    I'd like to know if there is a way to globalize a user defined function?
    I'd like to reuse a user defined function (e. g. DeleteLeadingCharacter) in several scenario/SWC instead of recreated it from scratch everytime - Is it possible?
    Thanks

    NO you cannot not reuse one UDF not even in other namespace even in the same namespace in diff Mapping programme.
    UDF is liminted to GraphicalMappingProgramme that you created you cannot reuse it in other MappingProgrammes.
    Like your MM =A has function <b>getMyName</b>
    you can use it in MM=A but if you want to use it in MM=B then u cannot.
    So its not possible in XI or PI.
    But it is possible in new release PI 7.1. That says you can write UDF and can reuse in any MM programme.
    Thanks
    Farooq.
    *Rewards Points if you find it useful*

  • How to create a motion tween?? :S

    Hii
    I know it is very easy. Right click>create motion tween>drag to where I would like the text/object to move
    BUT
    Sometimes it doesn't seem to work when i drag the text. It will work the first time and for the second text on the frame it won't work. I don't why .....any help???
    Can someone tell me the requirements of a motion tween when it comes to text on a single layer  in the same frame.
    Thanks

    You can only tween one object in a layer, so if you are trying to tween more than one it will break the tween.  Keep your different textfields on different layers.

  • How to create textpool by using standard function module?

    hi,
    gurus.
    I have find two function modules ( RS_TEXTPOOL_READ / BX_AGR_READ_TEXTPOOL ) which is used to read but i want to write into the textpool is there any standard function module

    REPORT ZTEST1.
    WRITE : / 'ddddddd'.
    WRITE : / 'ddddddd'.
    WRITE: / 'hhhhhhh'.
    WRITE: / 'ddddddd'.
    WRITE: / 'ddddddd' , 'uuuuuuuu'.
    WRITE: / 'ddddddd', 'sssssssss'.
    for example i am this report i want to convert it into text elements like
    REPORT ZTEST1.
    WRITE : / 'text-001'.
    WRITE : / 'text-001'.
    WRITE: / 'text-002''.
    WRITE: / 'text-001''.
    WRITE: / 'text-001'' , 'text-003''.
    WRITE: / 'text-001'', 'text-004'.
    this elements also store into the textpool so how can we achieve  this functionality by using standard function module.
    can any body give some idea .
    shabeer ahmed

  • How to create a push button to function like a File Browsing button

    Hi...
    I am a beginner with Oracle Forms developer.. and I have a project which requires me to create a button to function like a file browsing button.. so that I can select a file to check for changes made to it.. And if changed to copy the file to another location...Please could u guys help me with this!!
    Thanks!!

    Hi,
    What is your forms version?
    Check this out if you are using web forms.
    http://www.oracle.com/technology/sample_code/products/forms/extracted/hyperlink/fileupload.html
    If you are using client server, check out the online help for GET_FILE_NAME built-in
    Also, you can check out the webutil (for web forms >= 10g)
    -Arun
    Edited by: Arunkumar Ramamoorthy on Sep 10, 2009 1:49 AM

Maybe you are looking for

  • Site of the day 21-nov-2014

    Hello people, I was browsing the "site of the day" page to find some inspiration and I got into a website with a layout that I'd like to recreate, sort of... This is the one: http://www.astridantun.no Vertical layout, with fullscreen background image

  • Doubt in loading 0ic_c03

    hi, i am loading an inventory cube from data source 2lis_03_bf for initial load i filled the set up tables the last date in set up tables is 01.01.2007 correct me i am wrong for init load up to 01.01.2007 i will set 'no marker update' for deltas from

  • How to remove texture from a scanned photograph

    PSE 8, Epson Perfection V700 Photo scanner, Windows XP I am scanning some old photos to use in a photobook. The photos were printed on textured paper. The texture is not really noticeable on the original photo but quite noticeable on the scanned imag

  • External iSight camera's compatibility with OS 10.5.8 / iMovie 09

    I'm new here and joined because I couldn't find the answers to my questions anywhere on the net. I just upgraded my OS to 10.5.8 and then installed iLife 09, only to discover that my USB iMage webcam won't capture video in iMovie 09. So I've been res

  • Importing Pages into Pages

    I'm working on a newsletter with a few people from different computers. Is there a way to create a single page & then import it into the Newsletter