You have used the comma instead of dot to represent the float value. B Replace the comma with dot.
The code for declaring should be like -
Var i = 1.0
문제
I thought
var:Float = 1,0;
would work but it doesnt work since its already used by text. My other idea is that theres something else wrong im my program - I get error:
Scene 1, Layer 'ac3', Frame 1, Line 28 1084: Syntax error: expecting identifier before 0.
witch is pointing to
var i = 1,0;
Rest of my code -
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
import flashx.textLayout.formats.Float;
stop();
var timer:Timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, fadebgr);
timer.start();
function fadebgr(e):void
{
if(bgr.alpha <= 0) //read the last line of this post to know what is "bgr";
{
var i = 0;
while(i < 1)
{
bgr.alpha += 0,1;
i++
}
}
if(bgr.alpha >= 1)
{
var i = 1,0;
while(i > 0)
{
bgr.alpha -= 0,1;
i++
}
}
}
and the only thing I hove on screen is a movieclip (default black circle), named bgr.
해결책 2
You have used the comma instead of dot to represent the float value. B Replace the comma with dot.
The code for declaring should be like -
Var i = 1.0
다른 팁
There is no Float
native type in flash. You should use Number
. The Float you are importing has nothing to do with numbers and is a utility class for displaying text.
var i:Number = 1;
Though you are using it as an integer and flash does have a native type for that:
var i:int = 1;
However, it looks you want to fade in/out your background? I don't see the purpose of your while loops if they only run one time.
This will step your alpha up/down by 10% every timer interval:
function fadebgr(e):void
{
bgr.alpha += (bgr.alpha <= 0 ? .1 : -.1);
}