Skip to main content
Known Participant
March 21, 2008
Question

Add a library symbol or graphic to the stage using ActionScript

  • March 21, 2008
  • 3 replies
  • 711 views
Hello Forum,

I apologize for asking this question. I have taken a bmp image, added it to my library (Flash CS3, AS3)
and converted it to a graphic (not a movie clip or a symbol).

Is there a way I can add this graphic to the stage using ActionScript? or, if i place the "graphic" on the stage to begin with, can I set its alpha to 0 (zero)?

And later tween it up to 1.0?

My intention here is to have something without the overhead of a movie clip.
I supposed i could make it a sprite - which is really a movie clip.

I saw a post in this forum that might have answered my question but this link (provided by the post)
does not take me anywhere - I did not find the answer in any case:
http://www.flashgods.org/forums/viewtopic.php?f=20&t=117

Thanks Again,

eholz1
This topic has been closed for replies.

3 replies

eholz1Author
Known Participant
March 24, 2008
Hello Mr. ntbdy!

Thanks for the tip. Again the forum enhances my knowledge of Flash CS3 and ActionScript 3.0. I think I like AS3 as opposed to AS2.

I know not much, but now I know a little more thanks to the forum.
I know about linkage in terms of movie clips and cute little "sprites", and now I can do much the same with a bitmap, and other images.

Thanks,

eholz1
Inspiring
March 21, 2008
Hi, eholz. After importing the image to the library, you need to associate it with a class in order to let AS3 use it. You do that by right-clicking, and choosing Linkage. Then the checkbox "Export for Action Script". Choose any appropriate class name, such as "BmpLogo". Notice that the base class is "flash.display.BitmapData"

Now you're ready to go:

var bmpData:BmpLogo = new BmpLogo(0, 0); // (width, height)
var logo:Bitmap = new Bitmap();
logo.bitmapData = bmpData;
logo.x = 100;
logo.y = 100;
addChild(logo);
logo.alpha = .5;


(Note that the width and height parameters don't matter.)

Inspiring
March 21, 2008
I don't have the answer, sorry, but I am curious why you're appologizing.


"eholz1" <webforumsuser@macromedia.com> wrote in message
news:fs1493$5f$1@forums.macromedia.com...
> Hello Forum,
>
> I apologize for asking this question. I have taken a bmp image, added it
> to
> my library (Flash CS3, AS3)
> and converted it to a graphic (not a movie clip or a symbol).
>
> Is there a way I can add this graphic to the stage using ActionScript? or,
> if
> i place the "graphic" on the stage to begin with, can I set its alpha to 0
> (zero)?
>
> And later tween it up to 1.0?
>
> My intention here is to have something without the overhead of a movie
> clip.
> I supposed i could make it a sprite - which is really a movie clip.
>
> I saw a post in this forum that might have answered my question but this
> link
> (provided by the post)
> does not take me anywhere - I did not find the answer in any case:
> http://www.flashgods.org/forums/viewtopic.php?f=20&t=117
>
> Thanks Again,
>
> eholz1
>