flash actionscript:
can anyone tell me what could be wrong with this script: #include "lmc_tween.as" this.my_btn.onRollOver = function(){ this.my_mc.slideTo(30, 30, 5); } the slideto works just on its own but when put into the onrollover method it does nothing. i no this is basic but any help will be much appriciated. thanx in advance.
here's how to debug: trace("outside handler this= "+this); this.btn1.onRollOver = function() { trace("inside handler this= "+this); this.my_mc.slideTo(30, 30, 5); }; you'll see the results in the output panel and should be able to deduce that you need to eliminate this.my_mc unless my_mc is a child of this.btn1. if you think my_mc is a child of btn1, you could double check by using: trace("outside handler this= "+this); this.btn1.onRollOver = function() { trace("inside handler this= "+this); this.my_mc.slideTo(30, 30, 5); trace("this.my_mc= "+this.my_mc); trace(my_mc); }; my guess is this.my_mc is undefined and trace(my_mc) will reveal the timeline that contains that code followed by my_mc. if trace(my_mc) is also undefined you have an incorrect movieclip name or you need a path reference to find my_mc. you can always place a trace(this) statement on my_mc's timeline to see its path. anyway, to remedy my guess is just need to use: this.my_btn.onRollOver = function(){ my_mc.slideTo(30, 30, 5); }
thank you so much for you speedy replys. your suggestions have worked a treat and you have taught me a new skill and saved me reworking my whole app to get around this problem. for this i am very greatfull. i have saved your advice for reference and am sure i will refer to it untill i know how to do it. keep up the good work mate.
firstly thanx for replying. i didn't realise the difference which you pointed out. my next question is then how do i use the trace to debug this? also, will using the target tool with the curser on a line inside the function give the correct script?
Don't see what you're looking for? Try a search.
|