Image re-use in flex

Hi,
I am trying out FlexBuilder 3 and seeing if I can put together a first project.
The layout is in module format, whereby the main application SWF loads modules as necessary.
The problem I have is that I am trying to find a tidy way to re-use embedded images.
So far, I have found the following website :
http://stackoverflow.com/questions/87557/in-flex-as3-how-do-i-get-a-class-definition-of-an -embedded-asset-with-getdefinit
However I've tried implementing both methods and cannot get the image to load.
In my last implementation attempt, I've tried the following.
(1) A class called SVImages
package com.test.serviceview
    import flash.display.Bitmap;
    [Bindable]
    public class SVImages
        [Embed(source="assets/images/1938022_small.jpg")] private static var WelcomeImage:Class;
        private var _image:Bitmap;
        public function SVImages(name:String)
            //_image = new this[name]() as Bitmap;
            var classDef:Class = SVImages[name] as Class;
            _image = new classDef() as Bitmap;   
(2) Within one of my modules
    <mx:Script>
        <![CDATA[
            import com.test.serviceview.SVImages;
            [Bindable]
            public var Handshake:SVImages = new SVImages("WelcomeImage");
        ]]>
    </mx:Script>
<mx:Image id="welcomeimg" source="{ WelcomeImage}" height="174" width="231" y="-2" horizontalCenter="-115.5"/>
All this compiles fine and there are no problems notified in Flex Builder.  The text label elements of my module show up fine in the application, but the image just does not appear.  I have tried changing the image source to reflect both the relative directory compared to the main application, and the relative directory compared to the module.  Neither option worked.  The image definitley exists because I can browse to it.
The problem is, I am both a Flex newbie and an ActionScript newbie.... so I don't know where to start looking for what's wrong !
Thanks for your help

Before anyone comments,
public var Handshake:SVImages = new
is actually
public var WelcomeImage:SVImages = new
I'm not that silly

Similar Messages

  • How to load and display a byte array (jpeg) image file dynamically in Flex?

    My web service client (servlet) received a binary jpeg data from an Image Server. The Flex application invokes the
    servlet via HttpService and receives the binary jpeg data as byte array.  How could it be displayed dynamically
    without writing the byte array to a jpeg file?  Please help (some sample code is very much appreciated).

    JPEGEncoder is only useful for converting BitmapData to ByteArray, not the other way around.
    By the way JPEGEncoder and PNGEncoder are part of the Flex SDK now, so no need to use AS3Lib (alltough it's a good library to have around).
    To display/use a ByteArray as image, use a Loader instance with the loadBytes method.
        Loader.loadBytes(bytes:ByteArray, context:LoaderContext = null);
    Listen for the complete event on the Loader.contentLoaderInfo and get the BitmapData in the event handler.
    private function loadJpeg():void {
        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);
        //jpgBA is the ByteArray loaded from webservice
        loader.loadBytes(jpgBA);
    private function loaderCompleteHandler(evt:Event):void {
        var t:LoaderInfo = evt.currentTarget as LoaderInfo;
        // display the jpeg in an Image component
        img.source = t.content;
    <mx:Image id="img" scaleContent="false" />

  • Unable to install ipa to iphone5s and ipad retina by Flash Builder 4.6 using latest Flex sdk 4.13

    I am using Apache Flex 4.13 FP11.1 AIR14.0 for my Flash Builder 4.6 in my windows 7. attatched is the code. I am using provisining profile and my iphone5 and ipad retina UDID is added in that. But exported application via flash builder for ios is not installing in my ipad retina display and iphone5. I including following default images.
    [email protected]
    Default-Landscape.png
    [email protected]
    Default-Portrait.png
    [email protected]
    Default.png
    [email protected]
    my test-app.xml files contents is as follows.
    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <application xmlns="http://ns.adobe.com/air/application/14.0">
      <id>com.miracle.Saraplayer</id>
      <filename>Sara Player</filename>
      <!-- The name that is displayed in the AIR application installer.
      May have multiple values for each language. See samples or xsd schema file. Optional. -->
      <name>
      <text xml:lang="en">Sara Player</text>
      <text xml:lang="zh">Sara Player</text>
      <text xml:lang="cs">Sara Player</text>
      <text xml:lang="nl">Sara Player</text>
      <text xml:lang="fr">Sara Player</text>
      <text xml:lang="de">Sara Player</text>
      <text xml:lang="it">Sara Player</text>
      <text xml:lang="ja">Sara Player</text>
      <text xml:lang="ko">Sara Player</text>
      <text xml:lang="pl">Sara Player</text>
      <text xml:lang="pt">Sara Player</text>
      <text xml:lang="ru">Sara Player</text>
      <text xml:lang="es">Sara Player</text>
      <text xml:lang="sv">Sara Player</text>
      <text xml:lang="tr">Sara Player</text>
      </name>
      <customUpdateUI>false</customUpdateUI>
      <supportedLanguages>en zh cs nl fr de it ja ko pl pt ru es sv tr</supportedLanguages>
      <versionNumber>0.0.0</versionNumber>
      <versionLabel>One</versionLabel>
      <description>Nothing here now</description>
      <!-- Settings for the application's initial window. Required. -->
      <initialWindow>
      <!-- The main SWF or HTML file of the application. Required. -->
      <!-- Note: In Flash Builder, the SWF reference is set automatically. -->
      <content>[This value will be overwritten by Flash Builder in the output app.xml]</content>
            <aspectRatio>portrait</aspectRatio>
            <renderMode>auto</renderMode>
      <autoOrients>false</autoOrients>
            <fullScreen>true</fullScreen>
            <visible>true</visible>
            <softKeyboardBehavior>none</softKeyboardBehavior>
        </initialWindow>
      <!-- The icon the system uses for the application. For at least one resolution, specify the path to a PNG file included in the AIR package. Optional. -->
      <icon>
      <image16x16>_icons/16.png</image16x16>
      <image32x32>_icons/32.png</image32x32>
      <image36x36>_icons/36.png</image36x36>
      <image128x128>_icons/128.png</image128x128>
         <image29x29>_icons/Icon-Small.png</image29x29>
         <image48x48>_icons/48.png</image48x48>
         <image57x57>_icons/Icon.png</image57x57>
         <image72x72>_icons/Icon-72.png</image72x72>
         <image114x114>_icons/[email protected]</image114x114>
         <image512x512>_icons/iTunesArtwork.png</image512x512>
         <image50x50>_icons/Icon-Small-50.png</image50x50>
         <image58x58>_icons/[email protected]</image58x58>
         <image100x100>_icons/[email protected]</image100x100>
         <image144x144>_icons/[email protected]</image144x144>
         <image1024x1024>_icons/[email protected]</image1024x1024>
      </icon>
      <!-- Whether the application can be launched when the user clicks a link in a web browser.
      Optional. Default false. -->
      <allowBrowserInvocation>true</allowBrowserInvocation>
        <!-- iOS specific capabilities -->
      <iPhone>
            <InfoAdditions><![CDATA[
      <key>UIDeviceFamily</key>
      <array>
      <string>1</string>
      <string>2</string>
      </array>
      <key>UIStatusBarStyle</key>
                <string>UIStatusBarStyleBlackOpaque</string>
                <key>UIRequiresPersistentWiFi</key>
                <string>YES</string>
      ]]></InfoAdditions>
      <Entitlements>
             <![CDATA[
                 <key>aps-environment</key>
                 <string>development</string>
             ]]>
         </Entitlements>
            <requestedDisplayResolution>high</requestedDisplayResolution>
        </iPhone>
    </application>
    The problem is that when i sync it via itunes. it shows Waiting... then it shows progress for installing. when i click the app icon in device it shows Installing... as shown in these images but never shows finished process.
    Dropbox - 1.jpg
    Dropbox - 2.jpg
    Dropbox - 3.jpg
    source: Dropbox - test.fxp
    i am a bit confused and project is stuck. i am helpless now.

    Even I am facing almost same issue
    Problem installing Adhoc version to iPhone and iPad - Development Environment Is - Adobe Flash CS6

  • Webservices a JPEG and using in Flex

    I have a webservice that passes a images back as a base 64
    encoded format. I have tested displaying the image in Coldfusion
    and it works fine. I have tried using decoding it and using
    loader.loadbytes and it show that i have bytes loaded but no
    content. I am not sure what to do next? How do i get an image to
    display in Flex from a base 64 encoded format. PLEASE HELP! :)

    I create separate folders based on the year and then the actual date of when I take images. You can make those folders anywhere on any hard drive that is connected to your Mac whether internal or external. I also use the Photoshop Photo Downloader that is included with Photoshop/Bridge and it will create the date folder so all I do is create a Year folder.
    Open Bridge or click on the Bridge icon in PS and in the File menu item in Bridge select "Get photos from Camera". It can be a camera connected to your Mac or a memory card from a camera. A window will open and you then select the camera or memory card. Set the location they will be downloaded to, just the folder and you can Browse to a folder that you created, then in the "Create  Subfolders drop down select what date stamp you want to use or or custom name or not to create subfolders at all.
    I've never cared for iPhoto one bit. I tried it but found it way to restrictive. It likes to have full control over how you interact with your images.

  • Image of dicom and flex

    Hi
    I want to display image of dicom by flex, can i do it ?
    would you tell me how to do ?

    Hi
    Dany
    I want to use the browser on dicom images, so I want to know, I will flex can realize the effect.
    Will i design c++ + java +flex ?
    Could you tell me how to do?
    Thank you very much

  • Have you used Macromedia Flex?

    Have you used Macromedia Flex? What's your opinion of it? My manager is good at
    latching onto the flavor-of-the-week, but things I've read about Flex makes it sound
    pretty good. Does anyone have any war stories?
    Thanks,
    Laszlo

    From what I understand, Flex can be compared, roughly to JSP:
    JSP:mixes html markup (typically) and jsp tags with Java and JavaScript in a text file (*.jsp).
    The jsp-engine compiles that and what's delivered to the client's browser is html+JavaScript.
    Flex: mixes XML markup with STL-like tags and tags for controls (they claim dozens, including tree
    and calendar controls, editable comboxes etc...) and tags for layout (think LayoutManagers).
    The event handlers are written in ActionScript which is supposed to be very JavaScript-like (and
    in one place I read it was statically typed, hurrah!). Again this goes in a text file (*.wxml).
    The Flex engine compile *.wxml files into flash programs (*.swf) and delivers this to Flash running
    on the client. Flash, not the browser, executes the dynamic content.
    Here are some of my concerns and non-concerns:
    The Ubiquity of Penetration (is that an episode of Oz or what?) Flash is on a lot of desktops, but
    Macromedia plays Three Card Monty by not pointing out that Flex needs the latest version (7)
    to run, and that version is not everywhere, yet. But as their surveys show, it may be everywhere within a year.
    This is a non-concern for me. I write apps for gov't employees so I've got a different issue: many of them
    work in the boonies where their LAN support is execrable. And on top of that, their desktops are so screwed
    down, the only thing they can install are browser plug-ins. So Flash fits.
    The cost. Flex retails for $12,000 USD. That's seems a lot to me for something that's just in
    the presentation layer.
    This is version 1.0. Flash may be stable but how buggy is Flex?
    Where's the Java?. ActionScript is supposed to be Java-like, but what would be cool would being
    able use a subset of Java and the API for the dynamic content. This could be compiled on the server-side
    and something like byte code could be sent to Flash to execute.
    How fast and responsive are the Flash programs?
    How big are the Flash programs generated by Flex to download? And how good are browsers at
    caching flash programs? Do they use the same mechanism as for caching images? I'd hate to
    redownload a flash program over a dialup line when bouncing between screens.
    How good are the controls that Flex delivers? How does it compare to Swing, say. How comprehensive
    Is their set of events?
    What do you need on the server-side? Flex communicates to sever apps via (1) Web Services
    (2) remote objects or (3) http calls, among other things. The Flex engine itself is a web-app, and
    they list their system requirements as WebSphere 5+ (although it runs in Tomcat 5.0). Unfortunately,
    our production admins only support WebSphere 4 Server.
    Aside: I went to a product demo on Monday, and I have to say salesmanship in software products
    creeps me out. Maybe because I came into programming through the back door, from math and logic,
    but at demos I feel like I'm being sold a used car. The presenters kept referring to ROI. What do I know
    about ROI? I thought they were talking about Le fils do roi...

  • Can I boot up a Tiger Disk IMage HDD using my Macbook Pro (with Leopard)

    Before my Ibook G4 crashed (tiger 10.4) I made a disk image using super duper. I purchased a Macbook Pro (leopard) and when I tried booting the disk Image I had made using superduper on a smart disk firewire drive, it would not recognize it.
    I held the option key when booting but only the Mac drive on the Macbook pro showed up. Is that a bug/flaw with leopard that you can't even boot an external HD disk image made using Tiger?
    I know the disk image is good because it boots on my G5 which has tiger installed.
    Thanks for a reply..
    Skip

    Allan Eckert and BCC99,
    Thanks for the responses. I REALLY appreciate it becuase I usually spend a lot of time spinning my wheels trying to make something work that doesn't.
    The reason I wanted to boot it was that my old IBOOK crashed and I wanted to boot up the old "clone" (not disk image - my poor choice of words) so that I could view some of my older emails that contained information that I wanted to view. I know I could do it on my G5 but I wasn't home and wanted to try my new Macbook.....
    Thanks again...
    Skip

  • I tried transferring my iphoto library from my old macbook onto my new macbook pro (via external hard drive), but when i open the new iphoto, it seems to have transferred ALL images ever used on my old macbook. so i tried to just del

    i tried transferring my iphoto library from my old macbook onto my new macbook pro (via external hard drive), but when i open the new iphoto, it seems to have transferred ALL images ever used on my old macbook. so i tried to just delete all those images so i could try a different approach to transferring, but the new iphoto won't let me do anything and every time i try to delete anything it crashes (since the image amount is so high).  please help!!
    MacBook Pro, OS X Mountain Lion (10.8.2), iphoto '11, version 9.4.2

    To move an iPhoto Library to a new machine:
    Link the two Macs together: there are several ways to do this: Wireless Network,Firewire Target Disk Mode, Ethernet, or even just copy the Library to an external HD and then on to the new machine...
    But however you do choose to link the two machines...
    Simply copy the iPhoto Library from the Pictures Folder on the old Machine to the Pictures Folder on the new Machine.
    Then launch iPhoto. That's it.
    This moves photos, events, albums, books, keywords, slideshows and everything else.

  • I tried transferring my iphoto library from my old macbook onto my new macbook pro, but when i open the new iphoto, it seems to have transferred ALL images ever used on my old macbook.  now iphoto won't let me do anything to fix!!

    i tried transferring my iphoto library from my old macbook onto my new macbook pro (via external hard drive), but when i open the new iphoto, it seems to have transferred ALL images ever used on my old macbook. so i tried to just delete all those images so i could try a different approach to transferring, but the new iphoto won't let me do anything and every time i try to delete anything it crashes (since the image amount is so high).  please help!!

    See http://support.apple.com/kb/HT1229?viewlocale=en_US - I doubt that it will solve your problem, though. You may want to post on the iPhoto forum - that's where all of the iPhoto experts hang out.
    Good luck,
    Clinton

  • Uploading image file using tcode se78  occuring some   Error

    Hai Gurus
          I am uploading image file using tcode se78 but while Uploading it giving some error i cant resolve the problem so any one help me plz
    Error    "Graphic LOGO could not be saved (2LOGO)"
    Regards
    Selvendran

    Hai
    Thanks
    I had done in all method but i can't save it 
    error is coming ..so plz help me to upload the image
    Error "Graphic LOGO could not be saved (2LOGO)"
    Regards
    Selvendran

  • How to use a flex custom component in an AS3 Class?

    Our software team has been developing flash applications using AS3 (via the FlashDevelop IDE and the free Flex SDK).  Recently, some members of the team started exploring FlexBuilder and Flex (wow... why did we wait so long?).  The problem is that some folks continue to develop using pure Action Script 3 (FlashDevelop) while others are creating custom components in FlexBuilder.
    How do the AS3 developers use the Flex Custom components built in FlexBuilder in their AS3 Applications?

    SwapnilVJ,
    Your suggestions enabled me to make progress, but I'm still having a problem.  Based on you suggestion, I learned how to make a swc using Flex Builder.  I successfully added the swc to the lib resource in my AS3 project (FlashDevelop).  I was able to instantiate one of my new components (code hinting even picked it up from the lib).
    When I run my app, my component is not visible.  I can trace properties of it and the values are correct.  Any thought why I might not be seeing my custom component?
    package trainer.games.board.MatchThree {
    import flash.display.Sprite;
    public class Test extends Sprite{
      private var cp:MatchingGameControlPanel; // <<< this is my swc custom component created in Flex
      public function Test() {
       cp = new MatchingGameControlPanel();
       cp.visible = true;
       addChild(cp);
       trace("width: ",cp.width); // <<< works and displays valid data for the component.

  • I have built a android application using adobe flex, and i have exported it with native air. The application is working fine on samsung phones whereas it is getting crashed on Moto Phones, which runs on android kitkat, is there any compatibility issue ?,

    I have built a android application using adobe flex, and i have exported it with native air. The application is working fine on samsung phones whereas it is getting crashed on Moto Phones, which runs on android kitkat, is there any compatibility issue ?, I have built a android application using adobe flex, and i have exported it with native air. The application is working fine on samsung phones whereas it is getting crashed on Moto Phones, which runs on android kitkat, is there any compatibility issue ?, I have built a android application using adobe flex, and i have exported it with native air. The application is working fine on samsung phones whereas it is getting crashed on Moto Phones, which runs on android kitkat, is there any compatibility issue ?

    Thanks, Flex harUI, for the direction in regards to isolating build changes. That aside (still working on it), can you offer any direction in regards to my original question on SDK and AIR compatibility? I'm specifically looking for a version compatibility mapping or anything that definitively states, "Flex SDK x.y.z works with the following versions of AIR". This information is crucial for us in order to more specifically plan our own roadmap built upon these two frameworks as we consider both existing installations of our software and future distributions.

  • How stop PS6 from removing the DPI value from an image when using "save for the web"?

    How stop PS6 from removing the DPI-value from an image when using "save for the web"?
    Example:
    - Open a tif image, that contains a dpi value (resolution).
    - Use the splice tool in PS6.
    - Export the slices with "Save for web", as gif-files.
    Then the dpi value is removed, the gif files has no dpi value (it's empty).
    How can we stop PS6 from removing the dpi value when using "save for web"?
    OR:
    When using the slice tool, how can we save the sliced pieces without PS removing the dpi value?

    you can make your art go a little bit over the bounds. or you can make sure your artboart and art edges align to pixels

  • What's the best way to save an 8.5 x 11 image for use as a page background in a PDF?

    What's the best way to save an 8.5 x 11 image for use as a page background in a PDF? My goal is to have a relatively small final .pdf file size that includes numerous pages with full 8.5 x 11 images as backgrounds in the document. If I save at 8.5 x 11 and 72dpi (example), the image is not 8.5 x 11, and the quality is not good enough. I need help with size, dpi, and file format to save as before I place it in InDesign and then save as a .pdf.
    Thanks,
    Jim

    Do exactly what I said then.  Create the InDesign document of the required dimension, and chose whether it will be high quality print, or Interactive PDF.  It really doesn't mater what format you bring the image into that document.  It can be JPG, PNG, but I usually use native Photoshop PSD.  The image does have to be of high enough resolution, but it can be many times bigger than iis required for the final export.  (InDesign does not import the image, but rather references it on your hard drive.)
    When you have placed your text and finished your page, then export it to PDF, but go through the tabs chosing suitable settings.  If the image needs to be downsized, InDesign will do that at this stage while building the PDF.
    If you can tell us how this presentation will be made (Projector, overhead projector, printed page etc. or just emailed to the end users) we can help you more with the final output settings. 

  • Can you use a flex application as part of a whole web page?

    Hello all,
    Have a quick question. I am coming over from a flash developing background, and I commonly used smaller flash files as 'part' of a entire web page.  For example, a small flash video player section with a combo box to select the video to play; this swf file would be sized at about 600px wide by 400px high. Then I would just put that in a div tag and add it to my web page.  I am trying to do this with flex, but I am running into issues. It seems that the actual published swf wants to run at 100% of the browser window size. I tried adjusting these dimensions; first trying within flex in the <application> height and width props, but that didnt do the trick; then tried to just use the published .swf file in the web page, and set its <object> properties to my required height and width, which 'almost' works but still falls apart when the video player's full screen button is pressed.
    So, is it possible to use a flex 'app' as part of a web page, or was flex intended to run on its own and 'not' as part of a web page? Thanks in advance!

    You definitely can. I typically drop the Flash/Flex app into a "mainContent" div within my larger page structure, so my page would look something like this:
    <html>
    <style type="text/css">
         #mainContent {height: 600px; width: 900px;}
    </style>
    <body>
    <div id="topNav">BLAH</div>
    <div id="sideNav">BLAH</div>
    <div id="mainContent">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                id="MyFlashApp" width="100%" height="768"
                codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                <param name="movie" value="MyFlashApp.swf" />
                <param name="quality" value="high" />
                <param name="bgcolor" value="#FFFFFF" />
                <param name="allowScriptAccess" value="sameDomain" />
                <embed src="MyFlashApp.swf" quality="high" bgcolor="#FFFFFF
                    width="100%" height="100%" name="MyFlashApp" align="middle"
                    play="true"
                    loop="false"
                    quality="high"
                    allowScriptAccess="sameDomain"
                    type="application/x-shockwave-flash"
                    pluginspage="http://www.adobe.com/go/getflashplayer">
                </embed>
        </object>
    </div><!-- close mainContent -->
    </body>
    </html>
    Note that I'm only using the HTML approach, but the Javascript should work just as well. With the flash set to width=100% and height=100%, it will fill the enclosing div, but that's it. So, if you wanted to make this expand vertically but not horizontally, just set your CSS style to height: 100% and leave width a px or em value. Note that the enclosing divs (i.e. if you had a wrapper div around the navs and mainContent) would also have to expand/contract.
    I don't know about the effects of going full screen, though.

Maybe you are looking for

  • I ahve problem with the no.of repeating values.

    hi i have written the code like below. but i am getting duplicate values. please let me know where i am wrong. REPORT ZEXAMPLE. tables: mara,s886. type-pools : slis. types: char1(4) type c. data: alv_fcat type slis_t_fieldcat_alv,       alv_layout ty

  • Not burning 4GB disc to capacity

    Any ideas why my discs stop when half full. A 4 GB disc will only burn about 1.2 GB material. It doesn't matter if I am using iDVD or Toast. Tracy

  • Too much time

    This trial offer is a long one.

  • Page number not printing on last page

    Hi all, I am ablt to print the total no of pages  in all pages ecept the last page. whats wromg in my code ? REPORT  ZDEMO_EOF NO STANDARD PAGE HEADING LINE-SIZE 100 line-count 27(2). types: BEGIN OF t_mara,         matnr TYPE mara-matnr,         ern

  • Reverb Isuues on Adobe Premier CS5

    Hi, I recently had my laptop repaired and now i have it back, open a new project and try to apply reverb to an audio file, when played back all i can hear is a scratchy, choppy sound, like a prolonged digital fart. the same thing happens with  any au