PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Working With Two onEnterFrame Functions
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Working With Two onEnterFrame Functions

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    57

    Exclamation Working With Two onEnterFrame Functions

    How can I combine these two functions without any of them failing or interrupting each other.

    Actionscript Code:
    onEnterFrame = function()
    {
        viel._x = 0;
        viel._y = 0;
        viel._width = Stage.width;
        viel._height = Stage.height;
        this.plst.gry._width = Stage.width;
        a = a * 2.800000E-001;
        maxScroll = minScroll - plst.cont._width + Stage.width - a;
        vidplayer._x = Stage.width / 2 - vidplayer._width / 2;
        vidplayer._y = (Stage.height) / 2 - vidplayer._height / 2;
        if (!slidingposition)
        {
            _root.footer.controlpanel.slider._x = _root.footer.controlpanel.seektotime._x + ns.time / totaltime * _root.footer.controlpanel.seektotime._width;
            updateAfterEvent();
        }
        else
        {
            seekpercent = (_root.footer.controlpanel.slider._x - _root.footer.controlpanel.seektotime._x) / _root.footer.controlpanel.seektotime._width;
            ns.seek(seekpercent * totaltime);
            updateAfterEvent();
        }
        // end else if
        _root.footer.controlpanel.bufferedbackground._width = ns.bytesLoaded / ns.bytesTotal * _root.footer.controlpanel.seektotime._width;
        _root.footer.controlpanel.sliderpassedtime._width = _root.footer.controlpanel.slider._x - _root.footer.controlpanel.sliderpassedtime._x;
        var _loc2;
        _loc2 = isNaN(totaltime);
        if (_loc2 == true)
        {
            _root.footer.controlpanel.lft.curtime.curtime.text = "00:00 | 00:00";
        }
        else
        {
            _root.footer.controlpanel.lft.curtime.curtime.text = formattime(ns.time) + " | " + formattime(totaltime);
        }
        // end else if
    }

    and

    Actionscript Code:
    function moveMe()
    {
    scback._y = 5;
    //get reference to the player symbol
    mon_contente = _root.mp3;
    //if mouse is over... stop here else hide the menu and do not stop on this frame
    if (doing == true) stop();

    onEnterFrame = function() {
        pinning = true;
        //scroll the list with mouse movement
        if (vidplayer._height > Stage.height) {
            //get the scrolling value
            value = _ymouse - mask._y;
            //bound to minimum and maximum
            if (value < 0) value = 0;
            if (value > Stage.height) value = Stage.height;
            //scroll with an easing animation
            mon_contente.animate(vidplayer, "_y", (mask._y + 25) - (((vidplayer._height + 50) - Stage.height) * (value / Stage.height)));
        }
        if (vidplayer._width > Stage.width) {
            //get the scrolling value
            value = _xmouse - mask._y;
            //bound to minimum and maximum
            if (value < 0) value = 0;
            if (value > Stage.width) value = Stage.width;
            //scroll with an easing animation
            mon_contente.animate(vidplayer, "_x", (mask._x + 25) - (((vidplayer._width + 50) - Stage.width) * (value / Stage.width)));
        }
    }
    onEnterFrame();
    }

    P.S. The function moveMe is activated when a button is pressed only.



    Please help, STUCK!!

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    If both are in one frame, then that's the problem, you can only have one onEnterFrame per object, and in this case, you have two, and one of them will cease to work! The solution would be to join the onEnterFrames together to only have one with both the codes!
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Member
    Join Date
    Sep 2009
    Posts
    57
    I have done this in the past but, the moveMe function does not work properly. The scrolling function does not function. Here is the example.

    Actionscript Code:
    moveMe();
    function moveMe ()
    {
    onEnterFrame = function()
    {
       
    scback._y = 5;
    //get reference to the player symbol
    mon_contente = _root.mp3;
    //if mouse is over... stop here else hide the menu and do not stop on this frame
    if (doing == true) stop();

    pinning = true;
        //scroll the list with mouse movement
        if (vidplayer._height > Stage.height) {
            //get the scrolling value
            value = _ymouse - mask._y;
            //bound to minimum and maximum
            if (value < 0) value = 0;
            if (value > Stage.height) value = Stage.height;
            //scroll with an easing animation
            mon_contente.animate(vidplayer, "_y", (mask._y + 25) - (((vidplayer._height + 50) - Stage.height) * (value / Stage.height)));
        }
        if (vidplayer._width > Stage.width) {
            //get the scrolling value
            value = _xmouse - mask._y;
            //bound to minimum and maximum
            if (value < 0) value = 0;
            if (value > Stage.width) value = Stage.width;
            //scroll with an easing animation
            mon_contente.animate(vidplayer, "_x", (mask._x + 25) - (((vidplayer._width + 50) - Stage.width) * (value / Stage.width)));
        }
        viel._x = 0;
        viel._y = 0;
        viel._width = Stage.width;
        viel._height = Stage.height;
        this.plst.gry._width = Stage.width;
        a = a * 2.800000E-001;
        maxScroll = minScroll - plst.cont._width + Stage.width - a;
        vidplayer._x = Stage.width / 2 - vidplayer._width / 2;
        vidplayer._y = (Stage.height) / 2 - vidplayer._height / 2;
        if (!slidingposition)
        {
            _root.footer.controlpanel.slider._x = _root.footer.controlpanel.seektotime._x + ns.time / totaltime * _root.footer.controlpanel.seektotime._width;
            updateAfterEvent();
        }
        else
        {
            seekpercent = (_root.footer.controlpanel.slider._x - _root.footer.controlpanel.seektotime._x) / _root.footer.controlpanel.seektotime._width;
            ns.seek(seekpercent * totaltime);
            updateAfterEvent();
        }
        // end else if
        _root.footer.controlpanel.bufferedbackground._width = ns.bytesLoaded / ns.bytesTotal * _root.footer.controlpanel.seektotime._width;
        _root.footer.controlpanel.sliderpassedtime._width = _root.footer.controlpanel.slider._x - _root.footer.controlpanel.sliderpassedtime._x;
        var _loc2;
        _loc2 = isNaN(totaltime);
        if (_loc2 == true)
        {
            _root.footer.controlpanel.lft.curtime.curtime.text = "00:00 | 00:00";
        }
        else
        {
            _root.footer.controlpanel.lft.curtime.curtime.text = formattime(ns.time) + " | " + formattime(totaltime);
        }
        // end else if
    }
    onEnterFrame();
    }

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Please provide FLA for me to see it in action!
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  5. #5
    Member
    Join Date
    Sep 2009
    Posts
    57

    Smile

    here is the fla file.
    Attached Files Attached Files
    Last edited by danddleo; 11-07-2011 at 10:29 PM. Reason: corrected fla version

  6. #6
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Please CS5, I don't have CS.5.5
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  7. #7
    Member
    Join Date
    Sep 2009
    Posts
    57
    ok, i edited the previous message with the correct fla

Tags for this Thread

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