|
-
convert Flash 5 code into Flash 8
I have a snippet of code written for Flash 5 and I would like to use it for Flash player 8. When i switch to Flash 8 in the IDE it no longer works. I dont have the skills to basically convert it myself but perhaps there is someone out there who could help me out here. It is not a whole lot of code.
In the file there is two snippets of code. On the first frame and on the ball itself.
Would really appreciate if someone could take a look at it.
www.kanzeon.se/external/ball.fla
Thanks
-
FK'n_dog
change the x and y variables so they don't conflict
with the x (Point.x property) and y (Point.y property)
PHP Code:
// code on main timeline -
PZ={xx:0,yy:0};
function hit(){
_root.ball.initZspeed =18;
_root.ball.gravity = 9;
_root.ball.initSpeed = -200;
zoomZ = 100;
shiftX = 0;
shiftY =0;
z0=100;
PZ = {xx:shiftX*(-1)+mcPeg._x, yy:mcPeg._y};
}
function f3dscale (z) {
var scale = zoomZ*z0/(z0+z);
return scale;
}
function f3dPoint (xx, yy, z) {
var x3d = (xx+shiftX)*f3dscale(z)/100+PZ.xx;
var y3d = (yy+shiftY)*f3dscale(z)/100+PZ.yy;
var pt = {xx:x3d, yy:y3d};
return pt;
}
function update3dObject (clip, xx, yy, z) {
var pt2 = f3dPoint(xxy, yy, z);
clip._xscale = _root.f3dScale(z);
clip._yscale = _root.f3dScale(z);
clip._x = pt2.xx;
clip._y = pt2.yy;
}
PHP Code:
// code on movieclip
onClipEvent (load) {
function init () {
this.xx = 0;
this.yy = -1;
this.z = 0;
_root.update3dObject(this, xx, yy, z);
initSpeed = -40;
initZspeed = 5;
gravity = 1.5;
count = 0;
animate=false;
_root.update3dObject(this, xx, yy, z);
_root.update3dObject(_root.shadow, xx, 40, z);
}
init();
}
onClipEvent (enterFrame) {
if (animate == false) { return; }
count++;
z += initZspeed;
xx+=0;
yy += initSpeed+(gravity*count)+14;
if (yy>=0) {
initSpeed=0-(initSpeed+(gravity*Count));
yy+=2*(initSpeed) ;count=0;
if(yy>=0){animate=false;}
}
_root.update3dObject(this, xx, yy, z);
_root.update3dObject(_root.shadow, xx, 40, z);
}
hth
-
not working
Thanks for the feedback but unfortunately it does'nt work. The ball is supposed to make several bounces just as it does if you switch to Flashplayer 5. The ball is also supposed to scale to simulate real physics.
When using your corrected code with Flash player 8 the ball is only doing one bounce and no scaling occurs. Would be very happy if you could help me solving this one.
Did it work for you after swithcing to FLash player 8 in the Flash IDE?
Thank you.
-
It works thanks!
After converting your code in CS3 it all works.
Thanks alot!
-
Flash 5 code to Flash 8
I have a snippet of code written for Flash 5 and I would like to use it for Flash player 8. When i switch to Flash 8 in the IDE it no longer works. The ball is supposed to bounce several times and scale as it does when choosing Flash player 5.
I previously got som tips and help here:
http://board.flashkit.com/board/showthread.php?t=742711
but it still doesn't work so I'll try again.
I don't have the skills to basically convert it myself but perhaps there is someone out there who could help me out here. It is not a whole lot of code.
In the file there is two snippets of code. On the first frame and on the ball itself.
Would really appreciate if someone could take a look at it.
www.kanzeon.se/external/ball.fla
Thanks
-
FK'n_dog
yesterday 10:25 - It works thanks!
Today, 08:13 - wtf ??  
Flash 8 file attached
Last edited by a_modified_dog; 11-30-2007 at 10:43 AM.
-
Thanks for your good work. I guess It's me that can't explain what I'm after.
I want to be able to use all the features and classes that comes with Flash 8 and actionscript 2.0 and still I want the ball code to work.
My problem is when i select flash player 8.0 in the Flash publish settings and compile the code no longer works. The ball is only doing one bounce without scaling when my goal is that it should behave just like it does when Flash player 5 is selected in the publish settings.
Sorry for not describing this in the first place. I thought I did.
-
FK'n_dog
hmm .. failed to notice that the file was Publishing for Flash 5
changed to Flash 8 and it fails
i tried declaring all variables with strict-typing, ie
var xx:Number;
var yy:Number;
var z:Number;
var animate:Boolean; and so on, without luck
List Variables shows 2 variables returning - NaN (Not a Number)
Variable _level0.ball.yy = NaN
Variable _level0.ball.initSpeed = NaN
can only suggest you plaster traces all over the file
to find where the logic is falling down
-
Ok, thanks for trying
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|