If you didn't want to hard code the paths you could do this:
public function handlePressedUP(){
theBall.onEnterFrame = function () {
_y -= 5; // Move ball by 5 px.
}
}
JOR
___________________________________
=== James O'Reilly
===
=== SynergyMedia, Inc.
=== www.synergymedia.net
Steven Loe wrote:
Solved. Was just a path-to-object problem. Changing the code to this takes care
of it:
public function handlePressedUP(){
trace("function");
_level0.Ball.onEnterFrame = function () {
_level0.Ball._y -= 5;
}
}
}
Thanks!
-Steven Loe
<><><><><><><
--- Hans Wichman <[EMAIL PROTECTED]> wrote:
Hi,
in your example i think it would have to be:
public function handlePressedUP(){
this.onEnterFrame = function () {
theBall._y -= 5; // Move ball by 5 px.
}
}
greetz
Hans
At 06:56 PM 11/22/2005, Steven Loe wrote:
I'd like to use a listener to instantiate an onEnterFrame when a keyDown
occurs.
In the code below, it seems that the the onEnterFrame
exists but "ball" dosen't move across the stage.
Is there a better way to approach this?
-Steven Loe
My code:
<code on frame 1 of fla >
var myBall:Ball = new Ball(this, 4);
var keyListener_obj:Object = new Object();
keyListener_obj.onKeyDown = function() {
switch (Key.getCode()) {
case 38 : // Key: UP ARROW
myBall.handlePressedUP();
break;
}
};
Key.addListener(keyListener_obj);
<class Ball>
class Ball extends MovieClip {
var theBall:MovieClip;
function Ball(target, depth) {
theBall = target.createEmptyMovieClip("Ball", depth);
theBall.attachMovie("Ball", "b0", depth);
}
public function handlePressedUP(){
function onEnterFrame() {
theBall._y -= 5; // Move ball by 5 px.
}
}
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders