how to use a scaled object(MC) to fill the background with the new properties
So lets say i have a stage 300 to 200 and all object that i have are for this dimensions.Also have an pattern function that fills the background.
But the user is thinking of resizing the stage to lets say 1024 to 480 (he switched from a phone to a tablet).And now the scale of the objects in the tablet screen are more than 3times before(when seen on the Phone)
How do i save the current new size object and use it in the creation of the new background (the 1024x480).
currently i have this :
public static const GAME_ORG_WIDTH:uint = 300;
public static const GAME_ORG_HEIGHT:uint = 200;
public function MainClass_road() {
addEventListener(Event.ADDED, init);
}
public function init(e:Event):void{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, setUpScreen);
}
public function setUpScreen(ev:Event):void{
stage.removeEventListener(Event.RESIZE, setUpScreen);
if(stage.fullScreenHeight > stage.fullScreenWidth){
gameStageWidth = stage.fullScreenWidth;
gameStageHeight = stage.fullScreenHeight;
}else {
gameStageWidth = stage.fullScreenHeight; // 480
gameStageHeight = stage.fullScreenWidth; //1024
}
rescaleRatio = gameStageWidth / GAME_ORG_WIDTH;
//rescale every object, ie:
myC.scaleX = myC.scaleY = rescaleRatio;
//start filling the Background with the pattern
tileBgF();
}
and then I use the while loop for filling the screen/background
public function tileBgF(e:Event=null):void {
var bgClip = MyC;
var i:int = 0;
var j:int = 0;
while (bgClip.x < stage.stageWidth) {
bgClip = MyC;
while (bgClip.y < stage.stageHeight) {
bgClip = MyC;
tileLayer.addChild(bgClip);
bgClip.x = bgClip.width * i;
bgClip.y = bgClip.height * j;
j++;
}
j = 0;
i++;
}
addChildAt(tileLayer,0);
}
why does it give me
| Line 52 | 1120: Access of undefined property MyC. |
and further more.After filling the background/screen with the pattern , how do i save it all like one big bitMap so i can use /add it after time without doing all the checking of screen and things again.