Skip navigation
Currently Being Moderated

pass a parameter in a class [(embed.....)]

Dec 16, 2011 12:01 AM

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;

 
Replies
  • Currently Being Moderated
    Dec 16, 2011 7:07 AM   in reply to anjemalo

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 19, 2011 1:28 AM   in reply to anjemalo

    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();

              }

         }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points