A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: function only fires once

  1. #1

    function only fires once

    Dumb newbie stuff, probably.

    I am trying to get a function to continue to run on a rollover of a button. On the rollover, it is calling this global function and nothing is happening. When I take out the nested enterFrame, the function behaves correctly but only fires once.

    Hopefully I made some sense.

    Thanks for your time!

    code:
    _global.getX = function() {
    _root.onEnterFrame = function() {
    createEmptyMovieClip("menu_holder", 5);
    menu_holder.loadMovie("thumbs/id1.swf");
    menu_holder._x = _xmouse+5;
    menu_holder._y = _ymouse-50;
    trace("here");
    };
    };


  2. #2
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Well you are correct in that you don't need the onEnterFame inside the function. What exactky does this id1.swf do? Like is it a small animation of somekind? It could be something from that swf thats doing something too your new swf.

  3. #3
    Hi walsher.

    Thanks for replying.

    It is an animation and a very simple tween, so it shouldn't be causing anything weird.

    Back to the original problem, though. Why wouldn't I need the enterFrame in side the function? I notice when I take it out, the trace only lists once in the output, but with it it continues to repeat the trace as I would expect it. I am wanting that movie clip to continue to load too to keep it under the cursor as long as I am in the rollOver state. Right now, as I rollOver several of these buttons with the same function the little thumbnail is positioning in different places, since it loads once where ever the cursor is fof that moment and then stops, which isn't the effect I'm trying to get.

    Thanks.

  4. #4
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    It could be something with the loadMovie being at the same depth and with multiple menu_holder movieclip. Also as a side note seeing as the swf file is just a simople why not recreate it as a movie clip and then just have it appear everytime you roll the button.

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