Hi,
I’ve created a box, which has a zoom in/out motion, also has got submenu box on it when cursor is on.
Here is the sample:
http://yum.moo.jp/050208/02bup.html
CODE:
package {
import flash.events.Event;
import flash.display.MovieClip;
public class DCbtn {
private var _clip:MovieClip;
var btn01:robtn01;
public function DCbtn(clip:MovieClip) {
_clip = clip;
_clip.addEventListener(Event.ENTER_FRAME,onLoaded);
_clip.buttonMode = true;
}
public function onLoaded(event:Event):void {
if(_clip.hitTestPoint(_clip.stage.mouseX,_clip.stage.mouseY,true)){
trace("ok!");
scscale(1,0.7,0.5);
//window.addChild(DisplayObject(sc01));
btn01 = new robtn01();
_clip.addChild(btn01);
//btn01.alpha = 1;
btn01.x = -100;
btn01.y = -70;
}
else{
trace("ok too!");
scscale(0.85,0.7,0.3);
_clip.removeChild(btn01);
//btn01.alpha = 1;
}
}
function scscale(mScale,acc,conv) {
var theScale:Number = 0;
//theScale = new Number();
theScale = theScale*acc+(mScale- _clip.scaleY)*conv;
_clip.scaleX = _clip.scaleY += theScale;
}
}}
But something is wrong…
If I keep running it, the speed is getting very slow, and sometimes it freezes…
Also there is en error message like “Error #2007: Parameter text must be non-null”
I checked some articles and assumed “stage” setting on my .as causes this null error, but I don’t know how I can fix it… probably it causes the running speed problem as well?
Is there any better code to create such kind of button box?
Please somebody help me!