A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: tiling external images w/ BitmapData

  1. #1

    tiling external images w/ BitmapData

    Hello Flashkitters,

    I'm trying to use the BitmapData class to tile an external image as a background in my flash movie.

    Here's my code...

    import flash.display.BitmapData;
    import flash.geom.Rectangle;

    var url:String = new String("loadbackgroundtexture/Vein.png");

    var imageRequest:URLRequest = new URLRequest(url);
    var imageLoader:Loader = new Loader();
    imageLoader.visible = false;
    imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, onBackgroundLoaded);

    function onBackgroundLoaded(event:Event):void
    var tile:BitmapData = new BitmapData(event.target.content.width, event.target.content.height); /**********/

    this.graphics.lineTo(this.stage.stageWidth, 0);
    this.graphics.lineTo(this.stage.stageWidth, this.stage.stageHeight);
    this.graphics.lineTo(0, this.stage.stageHeight);
    this.graphics.lineTo(0, 0);

    I'm sure my problem is on the line marked with /**********/, but I don't know how to load the imageLoader data into a BitmapData object. This would be much easier if I was using an image in my library, but I'd much prefer the capability of loading backgrounds dynamically from the server.

    Any help would be greatly appreciated!

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    press the picture...
    PHP Code:
    function onBackgroundLoaded (event:Event):void
    tile:BitmapData = new BitmapData(event.target.content.widthevent.target.content.height);/**********/
    tile.draw (event.target.content);
    graphics.beginBitmapFill (tilenulltrue,true);
    graphics.lineTo (this.stage.stageWidth0);
    graphics.lineTo (this.stage.stageWidththis.stage.stageHeight);
    graphics.lineTo (0this.stage.stageHeight);
    graphics.lineTo (00);
    graphics.endFill ();

    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

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