[AS3][TUTORIAL] How to replace background map with image

Posts 1–5 of 5 · Page 1 of 1
[AS3][TUTORIAL] How to replace background map with image
Go to _02t > _lM_ (CREATE _lM_ IT IF YOU DON'T HAVE IT)


And replace whole _lM_ with this:
Code:
package _02t
{
    import flash.display.Sprite;

    public class _lM_ extends Sprite
    {

        public function _lM_()
        {
            var local1:background = new background();
            local1.alpha = 1;
            local1.scaleX = (800 / local1.width);
            local1.scaleY = (600 / local1.height);
            addChild(local1);
        }
    }
}//package _02t
Got to _02t > _R_f (CREATE _R_f IT IF YOU DON'T HAVE IT)

And replace it with:
Code:
package _02t
{
import flash.display.Sprite;
import com.company.assembleegameclient.ui._zX_;

public class _R_f extends Sprite
{

    public function _R_f()
    {
        addChild(new _pM_());
        addChild(new _lM_());
        addChild(new _zX_());
    }
}
}//package _02t

Then add new .as file in src folder called background

And replace everything with:

Code:
package
{
import mx.core.*;

[Embed(source="background.png")]
public class background extends mx.core.BitmapAsset
{
    public function background()
    {
        super();
        return;
    }
}
}
And make 800x600 px png image called background and put it in src folder
Well, you also could easily replace every addChild(new _R_f()); with you background, insead of "kinda removing" that class.

And btw,
Code:
local1.alpha = 100;
is useless cuz the alpha value is between 1.0 and 0.0

Quote Originally Posted by ActionScript® 3.0 Reference for the Adobe® Flash® Platform
alpha:Number
Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4
Indicates the alpha transparency value of the object specified. Valid values are 0 (fully transparent) to 1 (fully opaque). The default value is 1. Display objects with alpha set to 0 are active, even though they are invisible.

Implementation
public function get alpha():Number
public function set alpha(value:Number):void
I just realize this will not work if someone have dynamic music xD

- - - Updated - - -

I think it's fixed now it should work fine
swag //10 chars
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?