Hi Everyone!
I’m new to this forum, and I really appreciate all you folks who stay up at night trying to solve other peoples mess! Thanks!
Now to the problem. I’m remaking the classic Solitaire game. When the player has finished the game all cards go crazy and fly around the screen. This is where my problem comes in.
I get the effect I want the only problem is that if i use a background image in my flash movie i cant see the effect, cause it draws at level0 (bmd.draw(this))! How do i get around this? Can i set the draw method to a specific level or to make it draw a displayObject that’s at a certaint level?
Here’s the code:
[FONT=Courier New][/FONT]
[FONT=Courier New]import fl.transitions.Tween;
import fl.transitions.easing.;
import flash.display.;
import flash.geom.;
import flash.display.;[/FONT]
[FONT=Courier New][/FONT]
[FONT=Courier New]var count:int = 13;
var orderCount:int = 0;
var topPosition:uint = this.numChildren - 1;
var bmd:BitmapData = new BitmapData(730, 580, true, 0xFFFFFF);
var order:Array = new Array(“spades”, “cloves”, “hearts”, “diamonds”);
var bm:Bitmap = new Bitmap(bmd);
var timer:Timer = new Timer(500, 0);
var currentColor:Object;
var currentCard:String;[/FONT]
[FONT=Courier New]function randomNumber(startNum:Number, endNum:Number):Number
{
var lowNum:Number = startNum;
var highNum:Number = endNum;
return (Math.random() * (highNum - lowNum)) + lowNum;
}[/FONT]
[FONT=Courier New]function timerHandler(t:TimerEvent):void
{
currentColor = order[orderCount];
currentCard = currentColor.toString() + count;[/FONT]
[FONT=Courier New] var xTween:Tween = new Tween(this[currentCard], “x”, Regular.easeOut, this[currentCard].x, -100, randomNumber(2, 3), true);
var yTween:Tween = new Tween(this[currentCard], “y”, Bounce.easeOut, this[currentCard].y, 455, randomNumber(2, 4), true);[/FONT]
[FONT=Courier New] orderCount++;
if(orderCount > 3)
{
orderCount = 0;
count–;
}
if(count < 1)
{
trace(“Timer cleared”);
timer.removeEventListener(“timer”, timerHandler);
}
}[/FONT]
[FONT=Courier New]function loop(e:Event):void
{
bmd.draw(this);
}[/FONT]
[FONT=Courier New]this.addChild(bm);
timer.addEventListener(“timer”, timerHandler);
addEventListener(Event.ENTER_FRAME, loop);
timer.start();[/FONT]
[FONT=Courier New][/FONT]
[FONT=Courier New][/FONT]
[FONT=Courier New][/FONT]
The cards are objects on stage. For example:
“cloves12”, “hearts5”, “spades2”, “diamonds13”
The problem is the bmd.draw(this) method. What can I use instead of “this” to draw at a certain level?