A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Components and dynamic content in flash??

Threaded View

  1. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    This works. First define the new parameter.

    [Inspectable(name = "image",type = String)]
    public function set image (im:String):void
    {
    _image = im;
    }
    public function get image ():String
    {
    return _image;
    }


    Then in the component script you write this:

    if (image != null)
    {
    var _Class:Object = getDefinitionByName(image) as Class;
    myBitmap = new _Class(width,height);
    var bMap:Bitmap = new Bitmap(myBitmap);
    addChild (bMap);
    }


    Somewhere you define myBitmap and cast as BitmapData.

    In the library you have a default image, here "dfaul". Click on the image in the library and go to properties and export for actionscript. Give a class name. I usually use the name of the image but without the extension. You have to do that with all the images in the library.
    Last edited by cancerinform; 10-23-2009 at 05:36 AM.
    - The right of the People to create Flash movies shall not be infringed. -

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center