[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Swftools-common] Actionscript acting stupid...
From: |
Tail Kinker |
Subject: |
[Swftools-common] Actionscript acting stupid... |
Date: |
Wed, 26 Jan 2011 02:17:24 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
I've got a chunk of script:
.flash filename="Cherries.swf" version=6 bbox=640x480 fps=24
.swf cherry "cherry.swf"
.put cherries0=cherry x=5 y=40
.put cherries1=cherry x=25 y=60
.put cherries2=cherry x=45 y=80
.action:
score = new Array(0, 0, 0);
initcherries = function ()
{
i = 0;
while (i < 3)
{
this["cherries"+i]._x = 20 + i * 20;
this["cherries"+i]._y = 120;
i++;
};
};
initcherries();
score[0] = 1;
updateScore = function ()
{
cx = 5;
i = 0;
while (i < 3)
{
if (score[i]==1)
{
this["cherries"+i]._x = cx;
this["cherries"+i]._y = 460;
cx += 20;
}
else
this["cherries"+i]._y = 500;
i++;
}
};
scoreUpdate = SetInterval (updateScore, 25);
.end
.end
Substitute any other 16x16 graphic for cherry.swf.
Now, the issue is this: When I compile this, the first function
(initcherries) works precisely as advertised. However, the second
function (updateScore) does not relocate the cherries, as intended.
Any other code inserted anywhere in updateScore works great. It is only
the relocation code (this["cherries"+i]._y) that seems to be ignored.
And the only difference between the two functions is that the second is
called by a SetInterval.
Before you mention the if statement in updateScore, inserting a similar
if statement in initcherries will result in code that still works as
advertised.
Any suggestions?
- [Swftools-common] Actionscript acting stupid...,
Tail Kinker <=