I used the code below to ensure the object won't move outside of the screen.
if (getProperty("/object", _x)<21)>
setProperty("/object", _x, 21);
}
if (getProperty("/object", _x)>155) {
setProperty("/object", _x, 155);
}
if (getProperty("/object", _y)<28)>
setProperty("/object", _y, 28);
}
if (getProperty("/object", _y)>180) {
setProperty("/object", _y, 180);
}
Saturday, November 25, 2006
Monday, November 20, 2006
ActionScript Bytes
Consulted the tutorial from Erin's Flash lite blog. Adjusted the script.
Now, the object can move "Left", "Right", "Up", "Down".
And I find out used case 1 instead of case 2, the ActionScript Bytes is reduced.
( for my project, it reduced from 788bytes to 773bytes )
case 1
if ( ) {
}
if ( ) {
}
if ( ) {
}
if ( ) {
}
case 2
if ( ) {
}
else if ( ) {
}
else if ( ) {
}
else if ( ) {
}
Now, the object can move "Left", "Right", "Up", "Down".
And I find out used case 1 instead of case 2, the ActionScript Bytes is reduced.
( for my project, it reduced from 788bytes to 773bytes )
case 1
if ( ) {
}
if ( ) {
}
if ( ) {
}
if ( ) {
}
case 2
if ( ) {
}
else if ( ) {
}
else if ( ) {
}
else if ( ) {
}
Subscribe to:
Posts (Atom)