Hello:
I have seen this code in ultitouch gesture samples. But I don't kno how can I pass a bitmap parameter to the stateme
nt [Embed(source="imagenes/prueba.jpg")],
please, can you tell me how can I use this code with other bitmaps using parameters in this class?
Many thanks to all of you.
package
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.TransformGestureEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.events.TouchEvent;
import flash.events.Event;
import flash.display.Stage;
[SWF(width=320, height=480, frameRate=60, backgroundColor=0x000000)]
public class GestureExample extends Sprite
{
[Embed(source="imagenes/prueba.jpg")]
public var ElephantImage:Class;
Not sure what you are asking what do you mean by
pass a bitmap parameter to the statement [Embed(source="imagenes/prueba.jpg")],
and
please, can you tell me how can I use this code with other bitmaps using parameters in this class?
If you can clarify what you are trying to achieve we should be able to help
ok still not really sure what you're after but you can embed 2 images
[Embed(source="imagenes/image1.jpg")]
public var Image1:Class;
[Embed(source="imagenes/image2.jpg")]
public var Image2:Class;
and then
create the 2 images
var image1:Bitmap = new Image1();
var image2:Bitmap = new Image2();
if you want to do this within a class you cna define a constructor
public class Foo
{
[Embed(source="imagenes/image1.jpg")]
public var Image1:Class;
[Embed(source="imagenes/image2.jpg")]
public var Image2:Class;
public var image:Bitmap;
public function Foo(image1:Boolean):void
{
if (image1)
{
image = new Image1();
}
else
{
image = new Image2();
}
}
}
Thank you very much.
That code is wonderful but is not exactly what I'm trying to do.
If I have for example 100 images I don't want to put all in the class, but pass through a parameter,
When you click on a picture, i want to pass this to the function or Class to show the image clicked.
And I don't know how to do it with [Embed(source="............ How works Embed[ ?
Can I write this within the class file, for example?:
[Embed(source=myImageVar)]
And call it within my fla file something like this?
myImageVar="elephant.jpg";
Foo(myImageVar);
Many thanks
North America
Europe, Middle East and Africa
Asia Pacific