Jump to content
Search Community

loading some Spites into one container(Sprite)

burn test
Moderator Tag

Recommended Posts

Im loading some images via ImageLoader into its own Sprite.

Know I will put all these Sprites into one (container, instancename:box) like this:

box.addChild(bg_container).

But it doesn´t work.

Any Idear why the Sprits in the container not visible or maybe not loaded.

 

Here my code:

package {
import com.greensock.TweenLite;

import flash.display.MovieClip;
import flash.display.StageScaleMode;
import flash.display.StageAlign;

import com.greensock.loading.ImageLoader;

import flash.display.Sprite;

import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.DropShadowFilterPlugin;

TweenPlugin.activate([DropShadowFilterPlugin]);

public class Main extends Sprite {
	private var wall : ImageLoader;
	private var burn : ImageLoader;
	private var till : ImageLoader;
	private var bg_container : Sprite = new Sprite();
	private var burn_container : Sprite = new Sprite();
	private var till_container : Sprite = new Sprite();
	private var box : Sprite = new Sprite();

	public function Main() {
		stage.align = StageAlign.TOP_LEFT;
		stage.scaleMode = StageScaleMode.NO_SCALE;

		box.width = 1000;
		box.height = 800;
		addChild(box);

		wall = new ImageLoader("bg.jpg", {width:800, height:600, z:0, container:bg_container});
		wall.load();
		box.addChild(bg_container);///did not work

		burn = new ImageLoader("Burn.png", {x:(stage.width / 2) + 200, y:(stage.height / 2) + 70, z:100, centerRegistration:true, container:burn_container});
		burn.load();
		box.addChild(burn_container);

		till = new ImageLoader("Till.png", {x:(stage.width / 2) - 100, y:(stage.height / 2) + 50, z:50, centerRegistration:true, container:till_container});
		till.load();
		box.addChild(till_container);

		TweenLite.to(till_container, 0, {dropShadowFilter:{blurX:50, blurY:50, distance:50, angle: 350, alpha:0.6}});
		TweenLite.to(burn_container, 0, {dropShadowFilter:{blurX:20, blurY:20, distance:20, angle:320, alpha:0.8}});
	}
}
}

Link to comment
Share on other sites

remove the following 2 lines:

 

box.width = 1000;
        box.height = 800;

 

and test.

 

your images should now show up fine, or at least it is what worked in my experiment.

if you want to change the width of box, do it after the images have loaded and it should work fine. ]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...