A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [as2] clearInterval Problem

Threaded View

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    2

    [as2] clearInterval Problem

    I have made a menu, that reads its content out of an XML file.

    When you move over the buttons, the scale, and alpha is set to 100.
    When you leave the button it is resetted to it's original size/position.

    But, if you move to fast over the buttons, they disappear. It's like the file doesn't call the clearInterval:

    Here is the code:
    code:

    //Begin of code

    a=3
    mcBalk=this.attachMovie("balk_mc","mc_balk",0)


    mcBalk._x=Stage.width-(mcBalk._width)
    mcBalk._y=(Stage.height/2)-(mcBalk._height/2)





    menu_XML=new XML()
    menu_XML.ignoreWhite=true
    menu_XML.onLoad=function(OK){
    if(OK){
    Menu_inladen(this.firstChild)
    }
    else{
    trace("No valid XML-file")
    }

    }
    menu_XML.load("XML/menu.xml")

    function Menu_inladen(data){

    aantalMenuItems=data.childNodes.length
    arrMenuItems=[]
    for (i=0;i<aantalMenuItems;i++){
    ItemNaam=data.childNodes[i].childNodes[0].firstChild
    UrlImg=data.childNodes[i].childNodes[1].firstChild
    arrMenuItems.push({nr:i, name:ItemNaam, UrlImg:UrlImg});
    }


    for (i=0;i<arrMenuItems.length;i++){
    mc=this.attachMovie("button_mc","mc_button"+i,i+1)
    mc._xscale=50
    mc._yscale=50
    mc._alpha=50
    mc._x=470
    mc._y=50+(i*80)
    mc.obj=arrMenuItems[i]
    mc.obj.mc=mc
    UrlImg=mc.obj.UrlImg
    mc.image_mc.loadMovie(UrlImg)
    mc.onRollOver=function(){

    RollOver(this.obj)

    }
    mc.onRollOut=function(){

    RollOut(this.obj)
    }



    }
    }
    function RollOver(obj){
    intervalROver=setInterval(IntervalRollOver,1,obj)


    }
    function RollOut(obj){
    intervalROut=setInterval(IntervalRollOut,1,obj)
    }

    function IntervalRollOver(obj){

    if(obj.mc._xscale<100){


    obj.mc._xscale=obj.mc._yscale+=a
    obj.mc._alpha+=a
    }
    else{
    clearInterval(intervalROver)
    }
    }
    function IntervalRollOut(obj){
    if(obj.mc._xscale>50){

    obj.mc._xscale=obj.mc._yscale-=a
    obj.mc._alpha-=a
    }
    else{
    clearInterval(intervalROut)
    }
    }
    // End of code

    Last edited by VisuaPix; 01-24-2005 at 04:30 PM.

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