How to return the sprite object?

I want to load both image and add each image to each sprite object, like photo one sprite1 and photo b to spriteb, I know that I can load a pictue with the following code:

loadImage ('a');
loadImage ('b');
private void loadImage(imagePath:String):void {}
var loader: Loader = new Loader();
loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onImageLoaded);
Loader.Load (new URLRequest (imagePath));
}
private void onImageLoaded(event:Event):Sprite {}
var loaderInfo:LoaderInfo = event.target as LoaderInfo;
_loadedBitmap = LoaderInfo.Content as Bitmap;
Return runPostImageLoad (_sprite);
}
private void runPostImageLoad(_sprite:Sprite):Sprite {}
... photo of //load
}

But I want to make my code like the following, because I want to use sprite1, sprite2 for something else:
var sprite1:Sprite = loadImage ('a');
var sprite2:Sprite = loadImage ('b');

I don't know how to change the loadImage function to return the sprite object. Could someone tell me how to do?

Thank you

use:

private var _sprite:Sprite;

.

.

private void loadImage(imagePath:String):Sprite {}

var loader: Loader = new Loader();

Loader.Name = "Loader";

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

Loader.Load (new URLRequest (imagePath));

_sprite = new Sprite();

_sprite. AddChild ("Loader");

return _sprite

}

private void onImageLoaded(event:Event):void {}

var loaderInfo:LoaderInfo = event.target as LoaderInfo;

_loadedBitmap = LoaderInfo.Content as Bitmap;

runPostImageLoad();

}

private function runPostImageLoad (): void {}

just draw the shape of the irregular part

If (_loadedBitmap...) {

_sprite.removeChild (_sprite.getChildByName ("loader"));

_sprite. Graphics.drawRect (...);

}

}

p.s. Please check the correct and useful.

Tags: Adobe Animate

Similar Questions

  • Columns of folder: by default, how can return the first column 'Name' without having to move it manually every time?

    Something's happened awhile and when I create a folder which appears the first column is the column 'Date modified '. By default, how can return the first column 'Name' without having to move it manually every time?

    Hello

    I suggest you to visit these links and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders#section_4

    http://Windows.Microsoft.com/en-us/Windows-Vista/folders-frequently-asked-questions

    It will be useful.

  • set_item_property changing the text, but how to return the original value

    Hi all
    I use Oracle Forms Builder 10 gr 2 / I have the following problem: in a button I trigger when it is pressed. And then I change a few elements prompt text. But my problem is how to return the original prompt text. A kind of refresh or clear?


    Here is a piece of code that modifies the prompt text:
    set_item_property('XXBG_CE_STATEMENT_LINES_NEW.AGENT_NO', PROMPT_TEXT, get_item_property('XXBG_CE_STATEMENT_LINES_NEW.AGENT_NO', prompt_text) || '*');
    Thanks in advance,
    Bahchevanov.

    This is not tested, but it's something like this:

    declare
       v_item  varchar2(200);
    begin
       v_item := get_block_property('block',first_item);
       loop
          exit when v_item = 'block.'||null;
          set_item_property(...);
          v_item := 'block.'||get_item_property(v_item,nextitem );
       end loop;
    end;
    
  • How to return the approver e-mail notification iProcurement in R12?

    Hi all

    How to return the approver e-mail notification iProcurement in R12?

    Symptom: A Summit a requisition to B, need for approval of B

    (1) B lost the e-mail that is sent by A
    (2) need B a new notification sent by A.

    environment: Oracle R12.1.2 | AIX 6.1




    Concerning
    Terry Chen

    I thank you for your answer, you want to reassign B once again?

    Yes.

    Can I use the feature "Rewind"? Can this function sends notification to the user again?

    Don't know if it would work for notifications of iProcurement, then please try first the option to reassign.

    Thank you
    Hussein

  • How to read the CBTManager object

    I do a special extendscript for my Robohelp project.

    And is going well.

    Only I can't understand how read you the CBTManager object.

    I need conditional Build tags in the current project to proceed, but I can't seem to make it work.

    I have probably something wrong and help is appreciated.

    The documentation says:

    27-6-2011 11-58-07.png

    So I tried the following:

       var CBT = RoboHelp.project.CBTManager;
       var CBTItem = CBT.item[0].name;
    
    
    

    But all I get is [undefined].

    CBTItem.count is back 3 that is correct. My project has 3 defined CBT.

    But I want to know the names!

    The Documentation says the CBT has these properties, but I can't read them.

    27-6-2011 12-02-13.png

    I hope you can help!

    Thanx

    Your Blokhuizen

    Hey tone,

    not to worry that much, you can appear by copying the XML shared @ https://acrobat.com/#d=v9IuLeOs1mfFewrY6gcS7A and place it under the path "C:\Program Files\Common Files\Adobe\Scripting CS4\robohelp dictionaries", it will begin to appear in ESTK if object model viewer is ESTK CS4 if ESTK 5 and just change the name of the folder ""CS4 Scripting dictionaries ' to "Scripting dictionaries CS5". "

    and in case that you are using a 64 bit OS then place under "Program Files x 86" instead of "Program Files"

    Hope it helps

    Ashish

  • How to get the remote object mode protect?

    Hi all

    I have a question for a remote object mode protect in drive x. need your help, thank you very much ~

    Background: I have a plugin running on drive x protect mode. Without a strong name, plug-in will load my DLL (manufactured by c#). Then, in this DLL, it will use

    _3rdProxy p (_3rdProxy) Activator.GetObject = (typeof (_3rdProxy), url); for a remote object of the 3rd application (made by c# also). Then I can make communication between my app plug-in and 3rd.

    But I got an error "Access denied", said. Anyone know how to get the remote object in this case? Thank you very much ~

    Since you have a reader integration key, you are advised to use our methods of support for the official Developer.

  • How to return the QML C++ bb::cascades:Control as a property object?

    Hi all

    I need to return the value of the property QML in C++ code, problem is that this value is object of bb::cascades:Control

    Look at the example:

    import bb.cascades 1.2
    
    Page {
     property NavigationPane currentNavigationPane: tab1.navHandle
     property int testprop:0
    }
    

    In C++, I need to retrieve the value of currentNavigationPane property (I suppose it must point to NavigationPane *)

           QVariant const   prop=__current_page->property("currentNavigationPane");
            NavigationPane* nav_p=prop.value();
            if (nav_p!=NULL){
                qDebug()<<"nav_p is not NULL";
            }
            qDebug()<
    

    As a result of this code: nav_p is the null pointer and app crashes without any note of debugging on qDebug()<>

    I found the solution by Exhibitor class c ++ in QML and I can call its methods with pointer to bb::cascades:Control as a parameter

    QML

    Page {
    id:this_page
        onCreationCompleted: {
            mainCPP.UpdatePage(this_page);
        }
    }
    

    C++

    Q_INVOKABLE void UpdatePage(bb::cascades::Page *call_back_page){
    if(call_back_page){
    qDebug()<<"Page is valid";
    }
    }
    

    By this method, I can use control of Cascade in C++

     

  • How to get the line object table View

    Hello

    I use Jdev 11.1.1.7

    My requirement is, there are two ways I can get lines in my logic, you're based getFilteredRows (RowQualifier) and vo.executeQuery () - on a specific condition or I should consider first or later...

    getFilteredRows() returns the line [], I need to find a way to make [Row] of the View object properly after ececuteQuery() on the VO... When I use vo.getAllRowsInRange () which returns only a single line, but what iterate the VO even, I see that there is more than one line... How can he get all the range of the VO table?

    Thank you

    You can set the size of the field-1?

    ViewObjectImpl (Oracle ADF model and Business 10.1.2 API components reference)before calling getAllrowsinRange?

  • How to reference the layout object in the program unit?

    Hello world

    I'm changing the outcome of the result of a F_Test_Result1 field, so I create a trigger of format for it, the code is showed in below:

    function boolean return F_Test_Result1FormatTrigger is
    Start
    If F_TEST_Result1 = "0" then
    F_Test_Result1: = "Pass";
    end if;
    return (TRUE);
    end;

    but the Report Builder returns error saying F_TEST_Result1 is not yet defined. so, how can I do to direct these layout object and the object of data (from the data model) in triggering?

    Thank you
    Bryan

    Published by: Bryanevil on April 22, 2009 20:50

    Hello

    I suggest to create a column formula in the group that contains the column PASS_FAIL_SUMMARY

    and use a PL/SQL code like this for the column in the formula:

    function CF_1Formula returns the Char type is
    Start
    If: PASS_FAIL_SUMMARY = '0' then
    return ("pass");
    on the other
    Return('--');
    end if;
    end;

    Then, set the column formula as a Source for the field in the layout.

    Concerning

  • How to calculate the 2 objects QTime?

    Hello

    I have 2 QTime object.

    QTime q1 = new QTime (3,0; 0)

    QTime q1 = new QTime (2,30,0);

    How can I calculate 2 object? I mean q1 - q2.

    I thank in advance

    mSecsTo gives you the difference in milliseconds during which between two objects of QTime

  • How to check the JSON object properties available

    Hi I have a JSON of WebService object.

    How to check the available JSON object?

    ex JSON:

    {

    name: "someName".

    DESC: 'someDesc '.

    }

    How to check the available name?

    Because sometimes not available from the server name properties

    void MyClass::httpFinished(QNetworkReply* reply)
    {
    QString data = (QString) reply->readAll();
    bb::data::JsonDataAccess jda;
    QVariant variant = jda.loadFromBuffer(data);
    QVariantMap variantMap = variant.value();
    QString name = variantMap.value("name").toString();
    }
    

    I want to hide component Label on my .qml if name not available from webservice.

    Thank you

    Kaz32 wrote:

    Hi I have a JSON of WebService object.

    How to check the available JSON object?

    ex JSON:

    {

    name: "someName".

    DESC: 'someDesc '.

    }

    How to check the available name?

    Thank you

    If you want to check if the name is available, you must use

    bool nameExists = variantMap.contains ("name")

  • Unable to return the Contact object!

    Nice day

    In trying to return to a contact in the address book, I get a runtime error that States "push modal screen is called from a thread not event," I know very well off the coast. In this case, I decided to use the trick of invokeAndWait update a screen on the thread of the Main Event. But now, even if the address book is displayed, he refuses to return to a contact. To return to my application, the only way is by the "ESC" key, which, of course, does not return a contact object.

    Does anyone know of a work around that? It's confusing me now,

    1) tap address book to the queue of the event.
    (2) turning a contact to the application without entering the key "ESC".

    See you soon,.
    Nik

            UiApplication.getApplication().invokeAndWait
            (
                new Runnable ()
                {
                    public synchronized void run()
                    {
                        try
                        {
                            final BlackBerryContactList list = (BlackBerryContactList)
                                PIM.getInstance().openPIMList(PIM.CONTACT_LIST,PIM.READ_WRITE);
    
                            Contact contact = list.choose(null, BlackBerryContactList.AddressTypes.EMAIL,false);
    
                            if (contact != null)
                            {
                                String email = contact.getString(Contact.EMAIL, 0);
                                System.out.println ("Name is : "+email);
                            }
                        }
                        catch (PIMException pe){}
                    }
                }
            );
    

    AW... Is not serious... think about it...

    If the contact does not have an e-mail address, it selects it, rather than the contact does is display.

    Use the method BlackBerryContactList.choose (No params).

    See you soon,.

    Nik.

  • How to get the targeted object

    can you tell, how to get the object currently targeted in a class

    for example, if I use the labelfield that has his focus, how to get and make changes to the text of labelfield

    I hope that you can get that I tried 2 say

    Thank you

    Not in a class, screen...

    Features screen with a method called getFieldWithFocus...

    Check it out...

    See you soon...

  • How to pass the number object type to bind the variable in a select statement

    Hello

    I have a scenario like,

    UI, we store the values in the type of object, and this object type must be spent in a select query to retrieve the data accordingly.

    Is it possible to do so.

    If this isn't the case, please let me know how to take the values of object type and pass to the select query.

    Kind regards

    I found it,

    Object_name ('parameters1', 'parameter2');

  • How to access the data object of Perl thread


    I am trying to import the OVF. I got like a lease and start download VMDK. I see the data passing by, but connection times out because I need to call HttpNfcLeaseProgress periodically since a thread separate to keep the connection open. The problem is that I can't find a way to share the data of HttpNfcLease corded Perl object, so that the thread can call the HttpNfcLeaseProgress method. I tried to share the fields type and the value of the MOR HttpNfcLease and build a new MOR in the thread and to call get_view, but I get a segmentation fault. Any help or examples on how to proceed would be greatly appreciated!

    It's COW with a fork.  So if your child's name in the API, this will impact the parent API session.

    You want to be sure that you disable the global VIM.  You can initialize a new VIM session using the same id of session of the parent to the child.  So two sockets.  Just be sure you don't disconnect until you're done with it.  You can change the behavior on VIM goes out of scope (UNDEF) with "unset_logout_on_disconnect()" on the VIM object, so it will not close the session if a child or parent is destroyed.  So make sure that you call logout on your own.

Maybe you are looking for