A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Timeline Ctrl Urgent HELP!

  1. #1
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870

    Timeline Ctrl Urgent HELP!

    I've heard of actionscript that controls the timeline of a movieclip, but how can you put a AS into a movieclip which controls the Main Timeline?

    Regards,
    Tongxn
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    movieclip with instance name - aClip
    main timeline code -
    Code:
    aClip.onRollOver = function(){ rev = true; };
    aClip.onRollOut = function(){ rev = false; };
    code on movieclip -
    Code:
    onClipEvent(enterFrame){
     if(_parent.rev){
     _parent.prevFrame(); 
     } else {
     _parent.play();
     }
     }

  3. #3
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    I don't get that please explain..
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    open a new fla
    make a 50 frame tween on main timeline( ball moving across screen )
    add a movieclip to a new layer, give it an instance name - aClip
    add a new layer for Actionscript

    in frame 1 of Actionscript layer add the main timeline code
    (Actionscript editor will show : Actions-Frame )

    select your movieclip and add the onClipEvent code
    (Actionscript editor will show : Actions-Movie Clip )

    Play the movie and mouse over/out of the movieclip, the
    main timeline will play forwards or reverse.

    This is a simple example of quote -
    "AS into a movieclip which controls the Main Timeline"

  5. #5
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    sorry I didn't explain myself clearly, I mean I didn't get the actionscript you gave..
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    what part of the ActionScript did you not understand ?

  7. #7
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    target _root.

    _root.gotoAndPlay("aboutUs");

    no matter where this code is, it will be talking to the main timeline (_root.).

    Hope this helps,
    1M.

  8. #8
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Oh that is a much better answer,

    Thanks,
    Regards,
    Yours sinserely,
    Tongxn
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  9. #9
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    _root will only work if your swf is the main movie.
    If you load this movie into another with movieClip.loadMovie() it will fail.
    Recommended to use _parent as the path from movieclip to main timeline.

  10. #10
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Oh right
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  11. #11
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    indeed

    _parent works well for relative paths. If, as the question asks, you want to control the main timeline from anywhere, _root is the absolute (and quickest) path to it.

    Good luck,
    1M.

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