Hi there…
i am trying to create different pictures on the screen that will zoom in giving the impression of proximity.
I can call the first picture but when it loads a second one, it doesnt change. Why is this?
Here is my code:
Here is my call
var balls_bounds:Object = new Object;
attachMovie("mc_pic_25", "ball"+1, balls_bounds);
CLASS Bouncer_alt ( I copied this class from Senocular, from his example of OOP)
[SIZE=3][FONT=Times New Roman]class Bouncer_alt extends MovieClip [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] // variables, all private - internally handled[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private var pic_x:Number = 0;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private var zoom_x:Number = 0;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private var zoom_y:Number = 0;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private var velocity_x:Number;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private var velocity_y:Number;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private var original_x:Number;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private var original_y:Number;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] // constructor[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] function Bouncer_alt() [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] {[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] original_x = _x;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] original_y = _y;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Mouse.addListener(this);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] onMouseDown(); // force mouseDown event[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] }[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] // onEnterFrame event to control bouncing[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private function onEnterFrame():Void [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] {[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _xscale += zoom_x;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _yscale += zoom_y;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _x += velocity_x;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _y += velocity_y;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] trace(_xscale);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] if (_xscale >500)[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] {[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ini()[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] }[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] }[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private function ini():Void[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] {[/FONT][/SIZE]
[FONT=Arial Black] //HERE is where i am trying to load a different picture[/FONT]
[FONT=Arial Black] //everytime this function is called.[/FONT]
[FONT=Arial Black] //but it doesnt work.[/FONT]
[SIZE=3][FONT=Times New Roman] pic_x = randRange(1, 326);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] this.attachMovie("mc_pic_"+pic_x, "pic_x", 20);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _x = randRange(255, 323);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _y = randRange(160, 228);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _xscale = 10;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] _yscale = 10;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] }[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private function onMouseDown():Void [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] {[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] zoom_x = zoom_y = randRange(0, 10);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] velocity_x = randRange(0, 5);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] velocity_y = randRange(0, 5);[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] }[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] private function randRange(min:Number, max:Number):Number [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] {[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] return randomNum;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] }[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT]