Here you go:

import flash.utils;
import flash.display.*;

private function generateFromLib(source_ID:String):BitmapData
                {
                        var classRef:Class = getDefinitionByName(source_ID) as 
Class;
                        var mySprite:Sprite = new classRef();
var temp_bmd:BitmapData = new BitmapData(mySprite.width, mySprite.height, true, 0x00FFFFFF);
                        temp_bmd.draw(mySprite, null, null, null, 
temp_bmd.rect, true);

                        return temp_bmd;
}


var mat:IMaterial = new BitmapMaterial(generateFromLib("linkage_id"));


this code translates a movieclip with your image as a bitmapdata
add of course linkage to your mc.

you can do same by just adding a linkage name to your image, flash returns you then a bitmapdata

like var bmd:BitmapData = new linkageid(w,h);


personaly i preffer the mc, because it allow to reuse and bring some mods without the need to reedit the source you can compose textures by reusing the same source. Which is very powerfull, much more than embeds


Fabrice



On Jun 26, 2009, at 12:48 PM, DesignByLefty wrote:


i'm totally ashame to post this

i can't use the [loadimage] with class thing because
i have a problem with flex.

i have tried BitmapFileMaterial with online source, wait for the
loading to be finished
then call a function with the rest of the code, didn't work either,
same error

and i can't find the basic way of creating a texture
working with Dot3BitmapMaterial

all the example i found are based on [ ] Class thing or
creating PhongTexture or whatever, i even try the way
the Away3d logo is made but have error too. i've tried
colorMaterial too.

could somebody be very nice and show me the very
basics of use BitmapMaterial(myBitmapdata); from
a library element. i've put my "checker.jpg" inside the
library with a class name of "checker"

Reply via email to