To load a png image using img_load_file()

I'm trying to load a png image file in my application to screen_blit later to a window.  I have a few questions:

1. How can I find the full path to a file in my package?

2. can I use img_load_file to decompress a png in RGBA8888 fits the image uncompressed bitmap blitting.   Someone at - it a code snippet, I can consult?

Thanks in advance.

Hello

Try the following steps to load the image file in your application.

First, add your image file in bar - descriptor.xml file in active tag

and give the path of the file as 'app/native/imagefilename. " I hope it will work for you.

Tags: BlackBerry Developers

Similar Questions

  • How to load external png image via xml?

    Can someone help me with the addition of a png image to a mc with an instance name.

    I want only to display a single image (no Gallery)

    I would like to get the url of the image via an xml.

    Here's a copy of my current action script which has already pulled in xml data that includes the node with the url of the photo.

    import flash.events.Event;

    import flash.events.MouseEvent;

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    var myXML:XML;

    var myLoader:URLLoader = new URLLoader();

    myLoader.load (new URLRequest ("links.xml"));

    myLoader.addEventListener (Event.COMPLETE, processXML);

    function processXML(e:Event):void

    {

    myXML = new XML (e.target.data);

    trace (myXML);

    menumv.carbtn.addEventListener (MouseEvent.CLICK, openCURL);

    menumv.edubtn.addEventListener (MouseEvent.CLICK, openEURL);

    menumv.psybtn.addEventListener (MouseEvent.CLICK, openPURL);

    menumv.stubtn.addEventListener (MouseEvent.CLICK, openSTURL);

    menumv.busbtn.addEventListener (MouseEvent.CLICK, openBURL);

    menumv.shabtn.addEventListener (MouseEvent.CLICK, openSURL);

    studentmv.stuname.Text = myXML.student.name;

    }

    function openCURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.car.url));

    }

    function openEURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.edu.url));

    }

    function openPURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.psy.url));

    }

    function openSTURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.stu.url));

    }

    function openBURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.bus.url));

    }

    function openSURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.sha.url));

    }

    And here's a copy of the node that contains the url

    <menu>
        <student>
        <name>testnamehere</name>
        <photo>http://10.0.0.2/test/photos/testnamephoto.jpg</photo>
        </student>
    </menu>
    

    I saw this tutorial but it was for a gallery, and I couldn't not to hack and slash to do what I want.

    http://Tuts.flashmint.com/creating-a-simple-XML-Gallery-in-ActionScript3/

    Thanks again in advance for any help.

    Check if this gives null if yes it would output menu.student.photo

    trace (Student.photo)

    var _request:URLRequest = new URLRequest (student.photo);

    var _ldr = new Loader();

    MC's movieclip where you add your image

    mc.addChild (_ldr);

    _ldr. Load (_REQUEST);

    _ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, load_complete, false, 0, true);

    function load_complete (event): void

    {

    whatever it is may be melted in the image

    }

  • Do not load the .png images

    I load the images from RSS feeds, it works perfectly with the images .jpg, but not PNG or any other format. Here is my code:

    function getImgUrl(str:String):String {}

    var model: RegExp = / SRC =------"([^ \"] + \.jpg | gif | tiff | jpeg | png) /ig; "

    can someone help me please.

    Thank you

    Naveen

    Expression is missing brackets - there need to alterations of the group. It should be:

    /src=\"([^\"]+\. (jpg |) gif | TIFF | JPEG | (png ()) / ig;

  • How can I add PNG image using custom?

    Hi guys,.

    It's my custom component.

    <components:EmployeeDisplay imageFile="abrilliam.png"/>


    Can you help me please how to add png format image.
    when i add png format image that time this image not displayed.
    what can i do?


    Thanks
    JaxNa

    Hi Jaxna,

    In your code below custom component, I could see no imageFile variable declared...


    http://ns.Adobe.com/MXML/2009.
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" >
          
       
    source = "images / {imageFile}" / > "
        
       

    Have you declared the imageFile variable in your component file above... check it out?

    If it is then declared to declare a variable of datatype Sttring imageFile and make Bindable...

    [Bindable] private var imageFile:String ="";

    Your new component code must therefore:


    http://ns.Adobe.com/MXML/2009.
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" >

    [Bindable] private var imageFile:String ="";


    source = "images / {imageFile}" / > "
        
       

    Also check the path to the image once... If it is given the correct path of the hierarchy...

    Thank you

    Jean Claude Chari

  • How to increase the size of a .png image

    Hi friends,

    How can I increase or decrease the size of a .png image using the method scaleImage32() of the EncodedImage class.
    Code samples will be very useful...

    Thank you
    Elizabeth

    Check this thread.

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=378&query.ID=8274...

  • There is no option of optical flow on my png image sequence clip, I looked in the video clip and speed/duration options. interpolation of time is not an option?

    I am trying to extend my clip (which is a sequence of png images) using optical flow, the clip runs better.

    When I right click on the clip - go to the speed/duration, there is no list drop-down option for optical flow, or an option for time interpolation.

    I also went to clip - video options, but there was no interpolation time or option of optic flow there.

    Please can someone find me?

    I use adobe first pro cc 2015

    It should be under effects/time/time warp. I found the easiest way is to add it to an adjustment layer in AFX.

  • When using an accept custom attribute on an input file his show all files rather than the files that I choose (accept = "image/jpeg, image/gif, image/png, image)

    Hi, I am trying to use the entry of the file accept to limit the type of file that the user can choose when downloading a file. in fact, I have two problems that I can't understand our:

     1. If i am using the value "image/*" its limit the user to all the images but if i am using a custom
         limit e.g. "image/jpeg,image/gif,image/png,image/bmp" its show all the limits in the select box but the
         default value for ths user is "All Files". In Chrome and IE10 its working as needed.
    
     2. When i am trying to limit to "swf" files using the value "application/x-shockwave-flash" its show "All Files".
         In Chrome and IE10 its working as needed.
    

    I use Windows 7.

    Thank you.

    Well, it seems you do what it says in the documentation: https://developer.mozilla.org/en-US/docs/HTML/Element/Input#attr-accept

    Firefox actually allow you to drop a folder that is not on the list? In other words, is the problem of acceptance is ignored, or that the filter does not display the dialog box?

    Have you had a chance to get all of the bugs in Bugzilla?

  • Can't see the .png images when I use a different user profile

    Original title: Vista + png files

    Vista as administrator, I can see png images, but cannot see them when I'm using a different user profile

    Have you checked the settings in the previous link?

    You can try to reset Internet Explorer: http://support.microsoft.com/kb/923737

  • using CC 2014 last PS how to take a png image and fade

    Last PS CC 2104, I have a low third title text png file name which is around 2/3 on the bottom screen - I need to disappear the last 1/3 of it... how?

    Assuming you want to fade to transparency, use a layer mask and a black-white gradient.  The luminance values darker on a layer mask make the image more transparent.

    That, once saved as a PNG image looks to...

    -Christmas

  • (SOLVED!... for the most part) Can I load an external image in my custom class?

    Hello!

    I started working a lot with the Classes, but I'm still reletively new to them.  I wrote a class "creature" (which extends Sprite), and I have everything works well... except when it comes to the display of the image of the creature.

    In previous programs, I was able to load external images using the Loader class.  However, this is possible on the main timeline in Flash, right?  Like this:

    var imgLoader:Loader = new Loader();

    imgLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, done);

    imgLoader.load (new URLRequest ("001.png"));

    function done(evt:Event):void {}

    addChild (Bitmap (imgLoader.content));

    }

    Ideally, I want to do is just have a function within my class.  The function must contain the addChild statement, so I might just do:

    var MyCreature:creature = new creature();

    MyCreature.loadImage ();

    However, I'd be just as happy if I could just load the Bitmap and return it to the class.  Then I could addChild myself in the main timeline:

    var MyCreature:creature = new creature();

    addChild (MyCreature.getBitmap ());

    I tried to put the Loader code in a function within the class of creature, however it does not work.  She didn't return errors, but it also doesn't display anything, despite the fact that it containing the addChild statement.  Using the command path, it looks like within the service implementation, but addChild does nothing.  Am I missing something?  Is there a better way?

    Here is the function in my class of creature:

    public void loadImage() {}

    var imgLoader:Loader = new Loader();

    imgLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, done);

    imgLoader.load (new URLRequest ("001.png"));

    function done(evt:Event):void {}

    trace ("it happens at this point very well");

    addChild (Bitmap (imgLoader.content));

    }

    }

    Thank you!

    Sorry!  Of course, I surf the Internet for hours, unable to find a solution, according to a post on the forum, and then I have a solution.

    http://StackOverflow.com/questions/5036650/AS3-addChild-in-a-class

    I just forgot to add the addChild (MyCreature) in the main timeline.  Duh.<>

  • load the png from the SD card

    I use the flash cs5 and air2.5 tools

    I just want to load the SD card as image or xml files

    and I have added the ok of permission, but still cannot load the png successfully

    I load the path as this:/mnt/sdcard/tipsdoo/aa.png

    someone did it?

    Thank you

    Sorry, my English is not very well

    Hello

    Use it instead:

    import flash.filesystem.File;

    var file:File = File.documentsDirectory.resolvePath("tipsdoo/aa.png");

    If (file.exists) {}

    trace (file. (URL);

    loader = new Loader();

    Loader.Load (new URLRequest (file.url));

    }

  • Loading external png with transparency

    Hello

    Im trying to create a system of navigation with a few buttons as3.0.

    Each button is a png image.

    When the import of images to the stage im I don't have problems of transparency, but the problem is that they are enough, not smooth not especially

    because im animating the using TweenLite.

    I thought that the only way to do this correctly is to load all images using as3 in bitmap objects and then use the smoothing property.

    The problem is that whenever I attribute the png to a bitmap object, I lose the transparency of information and get a white background...

    Anyone know how I can keep transparency information of png on the bitmap object?

    Thank you

    Here is a little code that loads a PNG with transparency, it softens and placed on stage.

    var a: Loader = new Loader();
    a.Load (new URLRequest ("spider.png"));
    a.contentLoaderInfo.addEventListener (Event.COMPLETE, done);

    function done (e: Event) {}
    var bit: image Bitmap = e.target.content;
    If (bit! = null) {}
    bit. Smoothing = true;
    }
    addChild (bit);
    }

  • How to load and place images dynamically

    I have a problem with loading images dynamically. I want to import a series of images and the display in the order across the screen. The images will have different widths, so it is important to know the width of each imported image as IM will place an image immediately to the right of the previous image. I thought that the code below would control the presentation, but the event handler seems to work (perhaps partly because the images are different sizes) not well.

    What should I do to control the positioning of the images?

    Thnks a lot.

    XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"creationComplete =" init () "> "
    < mx:Script >
    <! [CDATA]
    Mx.events import. *;
    private var imageLoader:Loader
    private var imageX:Number = 0;
    public void init (): void {}
    for (var i: int = 0; i < 4; i ++) {}
    imageLoader = new Loader();
    var url: String = "images/animal" + i + ".png";
    var urlReq:URLRequest = new URLRequest (url);
    imageLoader.load (urlReq);
    trace ("image =" + URL)
    container.addChild (imageLoader);
    imageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);
    }
    }
    public void imageLoaded(e:Event):void {}
    imageLoader.x = imageX;
    trace ("imageloader.x =" + e.Target.Width);
    imageX += e.target.width
    imageLoader.y = 100
    }
    []] >
    < / mx:Script >
    < mx:UIComponent id = "container" / >
    < / mx:Application >

    Unless I'm mistaking completely your goal, you do the way of things too hard on yourself.

    Install a HBox and addChild() to add images to that:

    (I made a few changes to make it work for me locally in order to do not copy/paste).

         
              
         
    
         
    

    In addition, you need to use the charger because it has other ways to load images, e.g., you can create a new Image, as I do above and set the source property to the path of the file, or you can embed images, but I guess that is not an option.

  • How to open a png file using firefox with windows 7

    In Windows XP, I could save an image in png format, and then open it using firefox, copy and paste into an excel spreadsheet. But I can't do this in Windows 7. Has anyone else encountered this problem and found a solution?

    Kind regards

    You should be able to select another program to open the PNG image and then find the Firefox program folder and select the firefox.exe program.

    If it does not the Firefox program appears in the Windows "Open with" list next time temporarily to set Firefox by default, then replace it at a later date to the preferred program.

  • png image does not open in Firefox (wants to download)

    This is one of those little annoying things. I enjoy working the Samarai. available from djape Sudoku puzzles. Solutions for all the different puzzles are available on a single page: http://www.djape.net/sudoku/wp/index.php/solutions/

    For puzzles, I can right-click on the image of the puzzle, open in a new tab, and print it from there. But the solutions are different - they are png graphics that are a link to the solutions page. I can not just with the right button, because the image is a graph generic blank puzzle. The link takes me to a .png file, but I can choose only to open the chart with preview or save the file. I prefer to open in a new tab and print it to in Firefox, because the title of the page (and therefore the date of the puzzle) may appear on the printed copy and I know what goes with what puzzle!

    I searched Add-ons that could allow me to don't solve this problem - no luck. Firefox preferences only let me not choose between 7.6 QuickTime plugin or a snippet, and they both just open in the preview.

    Whenever a web page has just a png image as part of its page, which loads well (including the graphics on the Mozilla support site). Why does a different problem just because it is accessible by a link?

    Any help you can offer would be greatly appreciated. Thank you!

    -Sarah

    Look to open them in the browser: https://addons.mozilla.org/firefox/addon/8207

Maybe you are looking for