How to incorporate and display a SWF in a Flex application.

Hi all

I'm trying to embed a swf animation in a flex 4.5 application and display it, but it does not work!

I get error after error.  When I try to use addElement(), I get the following error:

1067: coercion of a value of type mx.core:MovieClipLoaderAsset to an unrelated type mx.core:IVisualElement.

If I use addChild(), then he throws another error when running.

Here is my code:

[Embed(source="assets/con_mov.swf")]
private var connectMov:Class;
private var conMov:MovieClipLoaderAsset = new connectMov();

Here's the code I'm trying to use it to displey:

borderContainer.addElement(conMov);

I tried just to add to the application using this.addChild (connectMov), but I get an error during execution.  It's ridiculous!  Bringing a swf created in Flash into Flex and displaying should not require so much effort - IMHO.  There is a lot of documentation on how to embed a swf in Flex, but almost nothing about how to post!

It's just a simple animation placeholder so I need access to all the functions on the inside, I want to integrate rather than using swfLoader.

Thanks for any help or advice you can give!

Matt

Hello Matt,

Yes you are right, it is not necessary to set the source of the image that we add a movieclip with swf. It was a mistake in my

code, because I have tried it with too many crazy ways.

Now the SWFLoader, ABT

This technique works well with the SWFs that adds a graphical application or animations, but are not intended to have a large amount of interaction with the user. If you import SWF files that require a large amount of user interaction, you must build them as custom components. (Adobe Docs)

Thank you and best regards,

---------------------------------------------------------------------- ----------------------------

Kanchan Ladwani | [email protected] | www.infocepts.com

---------------------------------------------------------------------- ----------------------------

Tags: Flex

Similar Questions

  • How to read and display a my a miccrontroller (MCB1700) on labview signal connected via a port on a PXI machine CAN

    How to read and display a my a miccrontroller (MCB1700) on labview signal connected via a port on a machine PXI CAN?

    I tried using a DAQ Assistant, but the port is not included as one of the physical channels supported, even if all his drivers are up to date.

    Help, please...

    Thank you.

    If you can read it in MAX, then you should be able to run the NI CAN example.

    Help-> find examples

    Find the CAN and watch CAN Receive.vi.

    Basically, set up the network, open the object, read in a loop close object when it is done.

    If you have any questions about the example, go ahead and post your vi and we can work from there.

  • How to load and display Image

    Hello everyone.

    I type with very green fingers, so please excuse the question. Lessons learned from the examples, I tried to load and display an image in ActionScript. This is the original example that I work on:

    ...

    ...

    var bmd2:BitmapData = bmd.clone ();

    var infoBM:Bitmap = new Bitmap (bmd2);

    var back: MovieClip = new MovieClip();

    Back.Name = 'back ';

    back.rotationX = - 90;

    var bSurface:MovieClip = new MovieClip();

    bSurface.y = int (...

    bSurface.z = int (...

    bSurface.addChild (infoBM);

    var overlay: Sprite = new Sprite();

    overlay.graphics.beginFill (...);

    overlay.graphics.drawRect (0, 0, bSurface.width, bSurface.height);

    overlay.graphics.endFill ();

    bSurface.addChild (overlay);

    back.addChild (bSurface);

    var tf:TextField = new TextField();

    TF...

    TF...

    TF...

    bSurface.addChild (tf);

    ...

    ...

    I'm trying to place an image on the bSurface instead of the block of text, as described above. So far, I came with:

    var iSprite:Sprite = new Sprite();

    var iMatrix:Matrix new matrix());

    var bmData:BitmapData;

    bmData = new BitmapData (surface.width, surface.height, true, 123);

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete);

    Loader.Load (new URLRequest("c:\pixlr.png"));)

    function onComplete (event: Event): void

    {

    bmData = Bitmap (content LoaderInfo (event.target)) .bitmapData;

    }

    iMatrix.tx = 0;

    iMatrix.ty = 0;

    iSprite.graphics.beginBitmapFill (bmData, iMatrix, false, true);

    iSprite.graphics.drawRect (0, 0, surface.width, surface.height);

    iSprite.graphics.endFill ();

    surface.addChild (iSprite);

    ... and:

    var bmData:BitmapData;

    bmData = new BitmapData (surface.width, surface.height, true, 123);

    var loader: Loader = new Loader();

    var location: URLRequest = new URLRequest ("c:\pixlr.png");

    Loader.Load (rental);

    bmData = Bitmap (loader.content) .bitmapData;

    surface.addChild (bmData);

    but without success. I've been fails miserably for days now and would appreciate help.

    Thanking you in advance,

    Sofia.

    what you trying to do?

    If you just try to load an image (pixlr.png), use a relative path and something like:

    var loader: Loader = new Loader();

    Loader.Load (new URLRequest ("pixlr.png"));  put the png in the same directory with your fla and published files.  You can move after getting this work simpler example

    addChild (loader);

  • How to read and display the .ai file in CS4 SDK?

    Hi all

    I drew an own and saved the socument as file traingle.ai.

    Now, I want to read/open the traingle.ai file in the plugin.

    [Lets say, I want to read this file based on GoFilter ()]

    Is there an API to read file .ai in CS4 SDK? and display as well?

    If you mean autonomous (outside Illustrator) the answer is no. The SDK is reserved for the plugins loaded into Illustrator. If you want to open a file from Illustrator that is perfectly doable if. I think that AIDocumentList:: open() that will handle.

  • How to retrieve and display the image on screen stored in pim...

    Hello world

    Can anyone tell how to recover the image store in pim and then display it on the screen

    See the code below. I just copied it from PIM API doc

     import java.io.IOException;
     import javax.microedition.pim.Contact;
     import javax.microedition.pim.ContactList;
     import javax.microedition.pim.PIM;
     import javax.microedition.pim.PIMException;
     import javax.microedition.pim.PIMItem;
     import net.rim.device.api.io.Base64InputStream;
     import net.rim.device.api.io.Base64OutputStream;
    
     public class PhotoExample
     {
    
         private Contact _contact;
    
         public PhotoExample() throws PIMException
         {
             ContactList contactList = (ContactList) PIM.getInstance().openPIMList(
                     PIM.CONTACT_LIST, PIM.READ_WRITE );
             _contact = contactList.createContact();
         }
    
         public void setPhoto() throws IOException
         {
             byte[] photo = getSamplePhoto();
             byte[] photoEncoded = Base64OutputStream.encode( photo, 0,
                     photo.length, false, false );
             if( _contact.countValues( Contact.PHOTO ) > 0 ) {
                 _contact.setBinary( Contact.PHOTO, 0, PIMItem.ATTR_NONE,
                         photoEncoded, 0, photo.length );
             } else {
                 _contact.addBinary( Contact.PHOTO, PIMItem.ATTR_NONE, photoEncoded,
                         0, photo.length );
             }
         }
    
         public byte[] getPhoto() throws IOException
         {
             if( _contact.countValues( Contact.PHOTO ) > 0 ) {
                 byte[] photoEncoded = _contact.getBinary( Contact.PHOTO, 0 );
                 return Base64InputStream.decode( photoEncoded, 0,
                         photoEncoded.length );
             } else {
                 return null;
             }
         }
    
         private static byte[] getSamplePhoto()
         {
             // return the raw bytes of the photo to use
         }
    
         public static void main( String[] args ) throws Throwable
         {
             PhotoExample example = new PhotoExample();
             example.setPhoto();
             example.getPhoto();
         }
    
     }
    

    .

  • How to capture and display the end of line character in the report

    Hi guys,.

    I have a report that we are poster campaign ID, campaign name, and Description of the campaign.
    The result is coming like this

    Description of campaign campaign campaign ID name
    1 ABC 1 Plan June 13. 2 market July 1. 3. end July 30.
    Plan XYZ 2 1 13 June. 2 market July 1. 3. end July 30.

    But we want the data to be displayed in the following format.

    Description of campaign campaign campaign ID name
    1 ABC 1 Plan June 13.
    2 market July 1.
    3. end July 30.
    Plan XYZ 2 1 13 June.
    2 market July 1.
    3. end July 30.
    That the user has the possibility to enter several lines for the description in front end Application & want us to show the same way Description. How can I capture this end of the character in ETL? If he is already captured, then how to show in the report.
    I use Siebel as before end application and for the ETL using Informatica.

    Any help will be much appreciated.

    Thank you
    Rupesh

    OBIEE presentation Service is an HTML element based on software then it does not show the end file character CHR (10) or Chr (13).
    You must replace this with the HTML tag charcaters
    .

    I'm not sure of the name of the function, but you must make a formula like this

    replace(mytable.mycolumn, chr(10), '
    ')

    See you soon
    Nico

  • Problem loading and displaying a swf

    Hello

    I have six buttons, and I want each one to display a corresponding external loaded swf, 01.swf, 02.swf.

    It works fine, except that sometimes the sovereign wealth funds charge upward, and sometimes they are not.  For example, if I hit the 6 button, the 06.the swf loads.  But if I hit the button 6 after reaching the other 3 buttons, SOMETIMES 06.the swf loads, sometimes it doesn't work and I get an error that relates to the removeChild

    var loader2:Loader = new Loader();


    function showVid (evt): void {}

    If (e1.data.childAdded2 == true) {this.removeChild (loader2) ;};

    loader2. Load (new URLRequest("videos/"+e1.data.question_num+".swf"));
    loader2.x =-270;
    loader2.y = 155;
    loader2.contentLoaderInfo.addEventListener (Event.COMPLETE, displayVideo);

    function displayVideo (event: Event): void {}
    addChild (loader2);
    E1. Data.childAdded2 = true;
    }

    }

    1. your add/remove does nothing useful

    2. never nest named functions

    3 use:

    var loader2:Loader = new Loader();

    addChild (loader2);

    function showVid (evt): void {}

    loader2. Load (new URLRequest("videos/"+e1.data.question_num+".swf"));
    loader2.x =-270;
    loader2.y = 155;
    loader2.contentLoaderInfo.addEventListener (Event.COMPLETE, displayVideo);

    }

    function displayVideo (event: Event): void {}

  • How to load and replace random swf in the same charger on stage?

    Hi... it's very simple, but for some reason any escapes me: using AS3 how a swf file can load another swf to replace itself in the charger still on the stage, while at the same time calling a function of randomization in the first frame of the main timeline, to randomize the next swf?

    At the end of each swf (called "koan_ # .swf"), it is the following old AS2 code... it has been used to choose randomly, and then play a SWF of koan table:

    _root.index ++

    If (_root.index > _root.koan.length - 1) {}

    _root.index = 0;

    _root. KOAN.shuffle ();

    }

    _root.koan_loader_mc.loadMovie (_root. KOAN [_root.index]);

    This code on the first frame of the main timeline loads a koan random swf file correctly, but after that the koan plays I'd like to load a new swf random koan.

    function shuffle(a:Array):Array {}

    var len:Number is. Length-1;

    for (var ivar:Number = len; ivar > = 0; ivar-) {}

    var p:Number = Math.floor (Math.random () *(ivar+1));

    var t = a [ivar];

    a [ivar] = a [p];

    a [p] = t;

    }

    return a;

    };

    var: index: uint = 0;

    var koan_loader:Loader = new Loader();

    koan var: Array = ['swfs/koans/koan_1.swf","swfs/koans/koan_2.swf', 'swfs/koans/koan_3.swf', 'swfs/koans/koan_4.swf', 'swfs/koans/koan_5.swf', 'swfs/koans/koan_6.swf', 'swfs/koans/koan_7.swf', 'swfs/koans/koan_8.swf', 'swfs/koans/koan_9.swf', 'swfs/koans/koan_10.swf', 'swfs/koans/koan_11.swf', 'swfs/koans/koan_12.swf'];

    KOAN = shuffle (koan);

    koan_loader. Load (new URLRequest (koan [index]));

    MovieClip (this).koan_loader_mc.addChild (koan_loader);

    Thank you very much.  I tried several variations of updated AS2 code but am at my wits end.

    -Very well, bloody forums join the file for some reason, so here is the code:

    Copy and paste this code into a text file and save it as InterfaceEvent.as

    package {}

    import flash.events.Event;

    SerializableAttribute public class InterfaceEvent extends Event {}

    public static const = "koanFinished" KOAN_FINISHED:String

    public void InterfaceEvent (type: String, bubbles: Boolean = false, cancelable: Boolean = false, int index = - 1, item: Object = null) {}

    Super (type, bubbles, cancelable);

    This.index = index;

    This.Item = item;

    }

    public var int index = - 1;

    public var point: Object = null;

    override public function clone (): Event {}

    return new InterfaceEvent (this.type, this.bubbles, this.cancelable, this.index, this.item);

    }

    }

    }

  • How to import and display a .tif file?

    I imported a .tif file by reference, as I have done hundreds of times before with .jpg. Looks like it's important, but what I see on my page is a white square. However, I can resize the image to scale it (i.e. it looks like a graphics card is there) but I do not see the real picture. or it does not appear when I create a PDF file of the file.

    Clues or suggestions are appreciated.

    Re: right now it's a TIFF with transparency.

    FM does not support transparency or opacity in raster images. It allows clipping paths, but you know the trick.

    Transparency, but no opacity, at least some vector formats (EPS) doesn't work, but only in the output path (not an extract) and only if the object is a vector.

    Basically, you need to make all this compositing layer in an external application and import the final result.

    Re: Conditional watermarks hidden behind graphics

    Re: Is it possible to vary the opacity of a graphics object created by Framemaker?

  • [ADF, JDev12.1.3] How to design and integrate PDF reports in my web application?

    Hallo,

    I would like to know if JDeveloper offers the functionality for creating visually (dependent or not data db) reports for which the client can see the preview and then print the PDF file.

    It would be very useful to design a report like UI (so for example drag attributes from VO instance to the report).

    Thank you

    Federico

    No, there are none of these available components. You will need to create one yourself (doable but complicated) or use another product the report design, and then call the report of your app engine to return the repost for example in pdf format. The user can to decide to print it or not. At this point, the report is already downloaded on the client as for example pdf.

    Timo

  • How can I load a .txt file in my flex application?

    I have a project where my client want me to include a feature, it can easily update the text in the application by modifying a .txt file.

    I have a scroll pane component and the code so far looks like this:

    <? XML version = "1.0" encoding = "utf-8"? >
    " < xmlns:s ="library://ns.adobe.com/flex/spark"xmlns:fx = s:Group" http://ns.Adobe.com/MXML/2009 ">
    < s:RichText color = ' #2B 4381 "fontFamily ="Arial"fontSize ="108"height ="1608"tabStops ="S0 S50 S100 S150 S200 S250 S300"text ="TEST of DYNAMIC TEXT"width ="292"x ="0"y ="0"/ >
    < / s:Group >

    Note that this will always show "TEST of DYNAMIC TEXT" and I can't understand how to load the .txt into it.

    Please help as this is a very important project!

    Thanks, Dale

    HTTPService to load the text file.

    
    
         
              
         
         
              
         
         
    
    
  • AS3: How to access and control embedded sounds in an external swf?

    I rarely use the sounds in AS3/Flash. I use Flash Pro CS6, but I can't seem to understand how access control (play, stop, etc) sounds embedded in a SWF external loading in the main SWF file.

    It is easy to control them when they are incorporated on the main swf. However, on a responsible external SWR, I get all sorts of errors. For this application, I really need to incorporate in the external SWF file.

    I've read several solutions, but none seems not to work.

    I integrate the sound file mp3 called soundSegment1.mp3 tool to import Flash CS6 and then open the properties panel actionscript Flash select the name of the class: SoundSegment1. Can I change the class ID and create a file named SoundSegment1.as, and it saved right next to my document class main.as in the same directory. The code for the SoundSegment1 class looks like this:

    package  {

       
    import flash.media.*;


       
    public class SoundSegment1 extends Sound
       
    {

           
    public function SoundSegment1 ()
           
    {
               
    // no code in here
           
    }


           
    public function playSound()
           
    {
               
    var soundSegment1:Sound = new SoundSegment1();
               
    var channel:SoundChannel = soundSegment1.play();
           
    }
       
    }
    }

    Then, in my main.as, I made several attempts to play this sound such as:

    var fileLocation:URLRequest = new URLRequest(SWFToLoad);

    loader.load(fileLocation);

    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);

    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener);

    loader.contentLoaderInfo.addEventListener(Event.INIT, initListener); 


    function initListener(e:Event):void // I also placed this code on the completeListener and it didn't work

    {

         loader.content.soundSegment1.playSound(); // doesn't work. 

    }

    I get:

    Line XXX 1061: Call to a possibly undefined method playSound through a reference with static type flash.display:DisplayObject.

    Otherwise, I also read that I should be able to do something like this anywhere in the Main.as file:

    var theClass:Class = Class(loader.content.getDefinitionByName("SoundSegment1")); var theSound:theClass = new theClass(); theSound.play()  //doesn't work either.

    I also tried on the completeListener:

    var TheClass:Class = e.target.applicationDomain.getDefinition("SoundSegment1") as Class;

    var theSound:TheClass = new TheClass();
    theSound
    .play()  //doesn't work either.

    I get:

    ReferenceError: Error #1065: Variable SoundSegment1 is not defined. at flash.system::ApplicationDomain/getDefinition()

    I'm stuck and I really need this to work. I would really appreciate your help.

    Thanks in advance for any help provided. I really need to make it work, because I can not simply incorporate into the main SWF or load them individually outside one by one.

    Thanks again!


    You can use the load and loadCompleteF below:

    var SWFToLoad: String =...;

    var s:String = "SoundSegment1";

    Load (SWFToLoad, s);

    function load (urlS:String, classS:String) {}

    var ldr:Loader = new Loader();

    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, function(e:Event){loadCompleteF(e,classS);});)

    LDR. Load (new URLRequest (URL));

    }

    function loadCompleteF(e:Event,classS:String):void {}

    var loadedAppDomain:ApplicationDomain = e.target.content.loaderInfo.applicationDomain;

    var C: Class = loadedAppDomain.getDefinition (classS) in class;

    var instance: * = new C();

    Sound (instance). Play();

    }

  • How to view the monthly/annual statistics in terms of time past/calories burned, broken down by each individual activity such as run elliptical/outside etc. Y at - it a third party application that can help me to collect and display these data?

    How to view the monthly/annual statistics in terms of time past/calories burned, broken down by each individual activity such as run elliptical/outside etc. Y at - it a third party application that can help me to collect and display these data?

    Hello

    It is not currently possible to review the data the application integrated in activity or training on this basis. If you want Apple to consider adding this feature, you can suggest here:

    https://www.Apple.com/feedback/watch.html

    However, health and fitness data from other sources, iPhone, and Apple Watch are registered and grouped within the health on iPhone app. These data can be exported, which you may find useful to track the cumulative progress and/or analyze your activity more in detail.

    IPhone app activity also has a button for sharing (top right of the screen) that allows to share data - including social media, Messages, Mail, Notes, and a printer.

    Include third-party applications that can be useful, for example:

    Access to QS

    -"Access your HealthKit data in a table so you can Explorer using numbers, Excel, R, or any other tool compatible CSV."

    - https://itunes.apple.com/gb/app/qs-access/id920297614?mt=8

    SpectaRun workouts

    -"View from the workouts of your Apple Watch on your iPhone and to export these workouts so you can download them to your favorite online running community."

    - https://itunes.apple.com/gb/app/spectarun-workouts/id991723862?mt=8

    Data can also be exported directly from the application of the health (Health Data > All - Share at the top button on the right).

    Check the descriptions and support resources for third party applications for supported details of import and data analysis features.

    More information:

    Use the activity on your Apple Watch - Apple Support

    Use of the workout on your Apple Watch - Apple Support

    http://www.Apple.com/watch/health-and-fitness/

  • How can I display the printable two than non-printable ascii characters from a device and display it in a text box?

    Hello

    My send UUT to my computer via serial port of printable and non-printable ascii characters. The question is:

    (1) how to display all characters in a text box.

    (2) how can I display all these characters in hexadecimal format and display it in a text box?

    Thank you.

    Robert

    Text boxes can actually receive channels with printable and non-printable characters: nonprinting characters will be represented with a small square. For example, consider this code:

    tank has [512], msg [512];

    Create a string with embedded unprintable characters

    sprintf (one, "Hello: %c %c %c %c % c: World!", 1, 2, 3, 4, 5);

    Pass the string to the text box "such what."

    ResetTextBox (bH [1], b1_n, a);

    Format a hexadecimal representation of the string and add it to the text box

    FMT (msg, '\n%*d[zb1r16w2p0j1]', strlen (a), a);
    SetCtrlVal (Bosnia and Herzegovina [1], b1_n, msg);

    The result is as follows: the first line is the string passed "such what", what follows is the hexadecimal representation.

  • How to intercept the sockettimeout exception message and display in the user interface of the view?

    Hi my jdev - 11.1.1.7 version

    I ask a socket connection in my AM and I want to catch the exception of the sockettimeout of t and display the error message in the user interface of the view layer.

    I use customException class that extends DCErrorHandlerImpl, but if we use try catch, then exceptions doesnot reach customclass.

    How to catch exceptions and return to view the layer if we use the operation binding. ?

    Because you call the operation via the link layer, which is perfectly fine, you do not get an exception at all. Exceptions thrown in methods called via the link layer are captured by the framework and transferred to the appellant in the operation binding.

    For that, you get the list of errors after the call returns and add them as messages of faces

    execute the method

    Method.Execute ();

    List errors = method.getErrors ();

    If (! errors.isEmpty ()) {}

    handle errors errors here is a list of exceptions!

    We only get the first

    E receive = errors.get (0);

    FacesMessage msg = new FacesMessage (FacesMessage.SEVERITY_ERROR, e.getMessage (), "");

    FacesContext.getCurrentInstance () .addMessage (null, msg);

    }

    no error return to normal work

    Timo

Maybe you are looking for