A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: problems with createemptymovieclip and setinterval

  1. #1
    Junior Member
    Join Date
    Dec 2005
    Posts
    25

    problems with createemptymovieclip and setinterval

    to be honest im beginner in As3. I used to script my flash sites in as2. But for this day i must migrate to v.3 of AS. And i have some problems here.

    #1

    creating emptymovieclips and loading into them some content was quite easy in as2:
    Code:
    _root.createEmptyMovieClip("kontener",1);
    kontener._x=10;
    kontener._y=10;
    kontener.loadmovieclip("instancename");
    in as3 i have sth like that:
    Code:
    var mc:MovieClip = new MovieClip();
    mc.x=80;
    mc.y=10;
    addChild(mc);
    but what i need to do next?

    #2 my second problems is with setinterval. I have for example two mc's on my stage. Both of them has in first and last frame stop();. I want to do sth like that:

    - some delay in ms
    - action of mc#1
    - delay again ( diffrent time than in first time)
    - action of mc#2

    etc

    how can i do it in as3? maybe im wrong but i think that v3 is much more complicated that prvious versions of as..

  2. #2
    Junior Member
    Join Date
    Mar 2009
    Posts
    10
    you would need to user a timer?

    PHP Code:
    mc.stop();
    var 
    timer:Timer = new Timer(5000); // first param is delay in microseconds
    timer.addEventListener(TimerEvent.TIMERfirstMC);
    timer.start();

    function 
    firstMC(e:TimerEvent):void
    {
      
    timer.stop();
      
    timer.removeEventListener(TimerEvent.TIMERfirstMC);
      
    mc.play();

    Shane

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center