How to create two UILoader that can be nested with each other and save the parent UILoader - as3

Hi all,
I am currently researching on the problem but I can't find any solution in the web.
Here is my problem:
I have two UILoader instance (loader_inner and loader_outer) I need to have loader_inner to be part of the loader_outer. I have also a button that will save all contents on loader_outer. Unluckily, when I trigger the save function, I only got  a white image file. I was expecting that the contents of loader_outer (with loader_inner) to be saved also.
Note: background_1.jpg and rabbit.jpg are present in the directory. loader_outer and loader_inner where manually placed in the scene using UILoader component.
Here is a code snippet:
loader_inner.load(new URLRequest("background_1.jpg"));
loader_outer.load(new URLRequest("rabbit.jpg"));
loader_outer.addChild(loader_inner);
var bitmapData:BitmapData = new BitmapData(loader_outer.width,loader_outer.height);
bitmapData.draw(loader_outer);
var jpgencoder:JPGEncoder = new JPGEncoder(100);
var mybyte:ByteArray = jpgencoder.encode(bitmapData);
var myfile:FileReference = new FileReference();
myfile.save(mybyte,"test.jpg");
My expected output should be that background_1.jpg and rabbit.jpg should be saved in an image file and must be positioned like the ones placed in the scene.
Any ideas on this?
Thanks ahead.

the load method is asynchronous so you don't want to apply that draw method until both loads are complete.  ie, use a complete listener:
loader_inner.addEventListener(Event.COMPLETE.loadcompleteF);
loader_outer.addEventListener(Event.COMPLETE,loadcompleteF);
var loadNum:int=0;
loader_inner.load(new URLRequest("background_1.jpg"));
loader_outer.load(new URLRequest("rabbit.jpg"));
loader_outer.addChild(loader_inner);
// you should declare these variables outside this function so there are no gc issues.
function loadcompleteF(e:Event):void{
loadNum++;
if(loadNum==2){
var bitmapData:BitmapData = new BitmapData(loader_outer.width,loader_outer.height);
bitmapData.draw(loader_outer);
var jpgencoder:JPGEncoder = new JPGEncoder(100);
var mybyte:ByteArray = jpgencoder.encode(bitmapData);
var myfile:FileReference = new FileReference();
myfile.save(mybyte,"test.jpg");

Similar Messages

  • How do I Help Apple Care Stop Warring with Each Other and Fix the Problem with My iPhone that They Acknowledge Creating?

    How Do I Help Apple US & Apple Europe Stop Warring With Each Other And Fix The Problem They Created?
    PROBLEM
    Apple will not replace, as promised, the iPhone 5 (A1429 GSM model) that they gave me in London, UK, with an iPhone 5 (A1429 CDMA model).
    BACKGROUND
    My iPhone 5 (A1429 CDMA model) was purchased this year in September on an existing Verizon Wireless (VZW) line using an upgrade. The purchase took place in California and the product was picked up using Apple Personal Pickup through the Cerritos Apple Retail Store. I will refer to this phone at my "original" phone.
    The original phone was taken into the Apple Store Regent Street in London, England, UK on November 15, 2012. The reason for this visit was that my original phone's camera would not focus.
    The Apple Store Regent Street verified there was a hardware problem but was unable to replace the part.
    The Apple Store Regent Street had me call the US AppleCare. At first they denied support, but then a supervisor, name can be provided upon request, approved the replacement of my original phone with an iPhone 5 (A1429 GSM model) as a temporary solution until I got back in the US. And approved that the GSM model would be replaced with a CDMA model when I came back to the US. I will refer to the GSM model as the "replacement". They gave me the case number --------.
    The Apple Store Regent Street gave me the replacement and took the original. The first replacement did not work for reasons I do not understand. They switched out the replacement several times until they got one that worked on the T-Mobile nano SIM card that I had purchased in England, UK. Please refer to the repair IDs below to track the progression of phones given to me at the Apple Store Regent Street:
    Repair ID ----------- (Nov 15)
    Repair ID ----------- (Nov 16)
    Repair ID ----------- (Nov 16)
    The following case number was either created in the UK or France between November 15 to November 24. Case number -----------
    On November 19, 2012, I went to France and purchased an Orange nano SIM card. The phone would not activate like the first two repair IDs above.
    On November 24, 2012, I went to the Apple Store Les Quatre Temps. The Genius told me that my CDMA phone should not have been replaced with a GSM model in the UK and that this was clearly Apple's fault. They had me call the AppleCare UK.
    My issue was escalated to a tier 2 UK AppleCare agent. His contact information can be provided upon request. He gave me the case number -----------.
    The UK tier 2 agent became upset when he heard that I was calling from France and that the France Apple Store or France AppleCare were not helping me. He told me that my CDMA phone should not have been replaced with a GSM model in the UK and that this was clearly Apple's fault.
    The UK tier 2 agent said he was working with engineers to resolve my problem and would call me back the next day on November 25, 2012.
    While at the Apple Store Les Quatre Temps, a Genius switched the phone given to from repair ID ----------- with a new one that worked with the French nano SIM card.
    Also, while at the Apple Store Les Quatre Temps, I initiated a call with AppleCare US to get assistance because it seems that AppleCare UK was more upset that France was not addressing the issue rather than helping me. I have email correspondance with the AppleCare US representative.
    A Genius at the Apple Store Les Quatre Temps switched the replacement with a new GSM model that worked on the French SIM card but would not work if restored, received a software update, or had the SIM card changed. This is the same temporary solution I received from the Apple Store Regent Street in the UK.
    By this point, I had spent between 12-14 hours in Apple Store or on the phone with an AppleCare representative.
    Upon arriving in the US, I went to my local Apple Store Brea Mall to have the replacement switched with a CDMA model. They could not support me. He told me that my CDMA phone should not have been replaced with a GSM model in the UK and that this was clearly Apple's fault. My instructions were to call AppleCare US again.
    My call with AppleCare US was escalated to a Senior Advisor, name can be provided upon request, and they gave me the case number -----------. After being on the phone with him for over an hour, his instructions were to call the Apple Store Regent Street and tell them to review my latest notes. They were to process a refund for a full retail priced iPhone 5 64BG black onto my credit card so that I could use that money to buy a new iPhone 5 64GB black at the Apple Store Brea Mall to reoslve the problem.
    The Apple Store Regent Street did not process my refund. He, name can be provided upon request, told me that the AppleCare US did not do a good job reviewing my case, that they were incapable of getting to the bottom of it like they were, and instructed me to call AppleCare US and tell them to review this case number and this repair id. I asked if he read the notes from the AppleCare US Senior Advisor and he would not confirm nor deny. When I offered to give him the case number he accepted but it seemed like would do no good. Our call was disconnected. When I tried calling back the stores automated system was turned on and I could not get back through.
    Now I have the full retail price of an iPhone 5 64GB black CDMA on my credit card and Apple will not process the refund as they said they would.
    I've, at this point, spent between 14-16 hours at Apple Stores or on the phone with AppleCare representatives, and still do not have the problem resolved.
    SOLUTION
    AppleCare US and AppleCare Europe need to resolve their internal family issues without further impacting their customers.
    Apple is to process a refund to my credit card for the cost of a full retail priced iPhone 5 64GB black.
    DESIRED OUTCOMES
    I have an iPhone 5 (A1429 CDMA model) that works in the US on VZW as it did before I received the replacement phone in the UK.
    Apple covers the cost of the solution because I did not create the problem.
    Apple resolves their internal issue without costing me more time, energy, or money.
    This becomes a case study for AppleCare so that future customers are not impacted like I have been by their support system.
    Does anyone have recommendations for me?
    Thank you!
    <Edited by Host>

    Thanks, but I've been on the phone with AppleCare US (where I am and live) and AppleCare UK. They continue bouncing me back and forth without helping resolve the problem.
    Perhaps someones knows how to further escalate the issue at Apple?

  • Migration between two environments which can't communicate with each other

    My customer is intending to do migration from test environment to production environment using CCM.
    But the two environments are not in the same network.
    The environments' setting is as blew.
    BO TEST Repository can communicate with Web BO Server.
    BO PRODUCTION Repository (Cluster environment) can communicate with Web BO Server.
    BO TEST Repository and BO PRODUCTION Repository (Cluster environment) are in the different network, they can't communicate with each other.
    Setting Target Repository manually in CCM.
    Questions are:
    1. In CCM, as long as both Source Repository and Target Repository can communicate with Web BO Server, the migration will be successful.
       Is that right?
    2. If 1 is not right, is there additional setting should I do?
       For example, If I need to open some firewall port?
    3. Is there other attentions should I notice?
    Thanks

    Questions are:
    1. In CCM, as long as both Source Repository and Target Repository can communicate with Web BO Server, the migration will be successful.
    Is that right?
    Yes that is correct
    2. If 1 is not right, is there additional setting should I do?
    For example, If I need to open some firewall port?
    You have another option which is to use the BIAR files. Export your objects to a BIAR file in source environment, and import them from BIAR into the target environment
    3. Is there other attentions should I notice?
    when using BIAR files as solution, Make sure that you keep them < 1GB size to avoid corruption
    you may have to increase or adjust timeouts on input and output repository servers as well

  • Is there an application that can batch convert wma to m4a and save the output files to their respective original file location?

    I need to convert thousands (yes, really) of wma files to m4a.  The wma files are all located in different folders and each converted m4a file needs to end up in the same folder as its respective original wma file.  Does anyone know of an application that can do this?
    Thanks,
    Will

    I'm not completely sure that MPEG Streamclip can convert AVCHD footage (.mts files).  If MPEG Streamclip doesn't do the job, then get a copy of Clipwrap, which was designed for transcoding .mts files to QuickTime/Apple Intermediate Codec (that's the format/codec you need to convert the .mts files to for use in FCE).

  • How to create a user that can login the LDAP?

    I want to create a user that can login the OID/LDAP. I know how to create a user, it is allowed to login OIDDAS, but I also want the user to grant access to ldap directly. How do i do that?
    And how can I give it read rights and or update/delete rights on a specific tree?
    Regards
    Eelco

    Eelco,
    did you see the OiD developers guide? Here you find some examples how to create users in OiD using pl/sql or java.
    http://download-west.oracle.com/docs/cd/A97329_03/manage.902/a95193/smplcode.htm#637294
    how to use directory access control can be found in
    http://download-west.oracle.com/docs/cd/A97329_03/manage.902/a95192/access.htm#1054232
    --Olaf

  • How to create a vi that can be connected to any type of array

    I would enjoy to create a vi that can perform an operation (like resizing) on any type of array (array of string, of cluster, of num,...): Which type of control or indicator could I use for this purpose? Any Idea?
    Thank's for your help

    Olivier,
    to do this you have to use a variant input. You can wire any type of data to a variant input. Inside the VI you flatten the variant to a string. The flattened string of an array contains both data and length of the array. You reshape the array manipulating the string. When done, you unflatten the data to a variant and output it from the VI. The caller has to convert the variant input to the source array type. OpenG.org provides a quite extensive toolkit to manipulate variant data. Some VIs specifically manipulates arrays. To see a description of VIs go to : http://opengtoolkit.sourceforge.net/lvdata/index.html
    LabVIEW Data Tools can be downloaded from http://sourceforge.net/projects/opengtoolkit/
    You need both packages lvdata AND error.
    LabVIEW, C'est LabVIEW

  • Can i zoom into a picture and save the picture at  that view, can i zoom into a picture and save the picture at  that view

    Can I zoom into a picture and save it at that close up view?

    The simple answer is, "Yes".  Use Aperture's crop tool to create a Version that shows only the part you want to be visible.
    Instructions on using the Crop tool are here.
    If that isn't what you want, post back.

  • With two iPhones 4, turning on Facetime on both iPhones, turning on Data Roaming, Enable 3G, cellular data.  Wifi has been enabled on, Wi-Fi is on, 'ask to join networks' is on.  I cannot get the two iPhones 4 to do 'FaceTime' with each other.  Changes?

    May 16, 2011:  The two iPhone 4 phones, being next to each other, cannot do FaceTime.  with Data Roaming = On, Wi-Fi = On, 'Ask to join Networks' = On, Enable 3G = On, Cellular Data = On,
    Why is Facetime on one iPhone 4 not connecting to ther other iPhone 4 when both have the 'FaceTime' icon showing on both? 

    I will through that note and have applied the items in that note on both iPhones.  Both iPhones are in the same physical location.  Both appear to be connected to a wi-fi network.  Still no FaceTime connection.  Is it such that both iPhones must be connected to a Wi-Fi and that wifi must be a network without a password needed to join it?  I thought 'Data Roaming = On' was such that iPhone 4 would then find a wifi network without a password needed and one could use FaceTime. 
    Is that the incorrect assumption?   If yes or no, what specific items are needed to be checked before I do this again or be checked while attempting FaceTime.

  • How to create a DVD that can play on a computer

    I've finally become familiar with using Premiere Pro CS3 and Encore. When I'm creating a DVD I understand that it will be played on any standard DVD player but I would also like to have it play on a computer. Is there a setting which will allow this to happen?
    I've tried playing it on my PC as well as another, but nothing happens.
    Have I overlooked something?
    Thank you.

    Persius,
    Nearly every DVD that will play on a set-top player *should* play on a computer, provided two things:
    1.) the computer has a DVD player that can handle that flavor of DVD media, DVD RW, DVD-R, DVD+R, DVD DL, etc.
    2.) the computer has a software player installed. This feature has been removed from some common media players. You may need to locate, download and install a separate software player.
    There could be another discussion on interlaced vs progressive scan media, but I'll let you ask that question.
    Hunt

  • How to create BI templates that can appear on Blackberries

    Hello,
    I am trying to create web templates that will appear on some BI users' blackberries. They use Blackberry models 8110 and 8520. Using the Blackberry simulator for testing, I have managed to get the web templates to appear on the Blackberry screen.
    Unfortunately, I cannot display output in a table or graph format. Right now all I get is a line by line text display. I also cannot get variable screens to appear. We are using BI version 3.5 to create the templates. I understand it is not possible to use BW 7 for this purpose.
    Does anyone know of any tricks or techniques to get table or graphical web template output to appear on a Blackberry screen?

    Persius,
    Nearly every DVD that will play on a set-top player *should* play on a computer, provided two things:
    1.) the computer has a DVD player that can handle that flavor of DVD media, DVD RW, DVD-R, DVD+R, DVD DL, etc.
    2.) the computer has a software player installed. This feature has been removed from some common media players. You may need to locate, download and install a separate software player.
    There could be another discussion on interlaced vs progressive scan media, but I'll let you ask that question.
    Hunt

  • How to create a JButton that can run other Apps?

    Hi, Every1
    i want to create a JButton which can let the user click it and it runs a
    specified installed app in the system ( say, a JButton that fires up MS
    Outlook). how can i do that?
    thank you very much.
    Yu.

    hi, if i want to execute some kind of the following, how would i handle it?
    mailto:[email protected]
    i tried: Runtime.getRuntime().exec("mailto:[email protected]");
    but it gave me java.io.IOException: CreateProcess: mailto:[email protected] error=2
    i think this problem would be relatively easy but i just cant figure out.
    thanks

  • How to create a latch that can latch the input data for 50ms?

    Now I have some data come from the sensor. I want to latch this data for 50 ms and then reset it to 0. Does anybody do this before? Thank you

    Now I am using the "two button dialog" to create a dialog box. After the dialog box pop up, I choose "yes" the "two button dialog" will output a "True". My problem is that this "True" disapear too fast. My while loop frequency is only 20Hz. And I want to send this "True" value to somewhere. However the two "button dialog" will clear this "True" after 10ms?. So I always got a "false" value. How to "Freeze" this dialog box output value for at least 50ms? How to create a latch to hold this value?
    Attachments:
    Two_button_Dialog.bmp ‏1132 KB

  • How to create stored procedure that can be read through Hyperion intelligen

    hello everyone out there. I need some help I create a select stored procedure and would like to run it through Hyperion intelligence with some input parameters. The procedure is not working. it is throwing an error when I execute it through Hyperion. Also how do I put multiple values like an array sort of things in a where clause like this where name in('test', 'test1). I place the stored procedure below any help will be greatly appreciated.
    CREATE OR REPLACE PROCEDURE emp_by_dept (
    p_deptno ert_dept_t.dept%TYPE
    IS
    emp_refcur SYS_REFCURSOR;
    v_dept ert_dept_t.dept%TYPE;
    v_deptname ert_dept_t.deptname%TYPE;
    BEGIN
    OPEN emp_refcur FOR SELECT dept, deptname FROM ert.ert_dept_t WHERE dept = p_deptno;
    DBMS_OUTPUT.PUT_LINE('dept deptname');
    DBMS_OUTPUT.PUT_LINE('----- -------');
    LOOP
    FETCH emp_refcur INTO v_dept, v_deptname;
    EXIT WHEN emp_refcur%NOTFOUND;
    END LOOP;
    CLOSE emp_refcur;
    END;

    Chrome has its own PDF viewer plugin that is quite buggy when it comes to PDF forms (as do Firefox and Safari, by the way).
    So yes, the best solution is to download the file and then open it locally using Adobe Reader. However, you can't enforce that. It's up to the user and their browser settings. You can only recommend it to them.

  • How to create a SO that can be taken as account assignment object for PO?

    Dear all,
    I am trying to create a PO with ME21n and I want to assign the item to sales order item (SO). I put in account assignment group "C", but everytime I enter the SO number I get the message: "Account 612200 requires an assignment to a CO object                                                   
        Message no. KI235"
    So it seems that it does not recognize the SO as an CO object, although the help says you can assign to a sales order.
    What has to be done to get this assignment working?
    By the way "E" is also not working.
    Unfortunately I am neither in an individual purchase order scenario (because we do not always require a PR and moreover the material/service we must buy depends on many factors, so a subcontracting scenario with a BOM won't help neither) nor in a 3rd party order scenario.
    My scenario is: SO is entered. Sometimes we have to buy either a service or a material. Shipping is directly to us and we pay the supplier. When the whole SO is fulfilled we bill our customer for the material/services we bought for them and hopefully can put a little margin on top.
    Any ideas?

    Hi,
    i tried the same scenario, i was getting the same error but FICO consultant assigned the CO object to the GL acoount then it works i used the account assignment category C. but still i am testing this scenario because the cost is not going on SO.
    regards,
    Qasim

  • How to create PDF files that can't by copied by MAC

    Hi,
    I need to create pdf files that I can put on my website, that cannot be copied or edited by MAC users. I have created pdfs that can't be copied by Windows users, but they're still copyable by Mac users.
    Thank  you!
    Alicia

    Your Windows users must be exceptionally uninformed...

Maybe you are looking for