(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.<>

Tags: Adobe Animate

Similar Questions

  • MacBook Pro (retina, 15 inches, beginning 2013) El Capitan 10.11.3, Simple question here: I can't open FinalCut Express (4, I believe). The wheel turns for hours. How can I install/uninstall and will I lose all my old films (for the most part stored on ex

    MacBook Pro (retina, 15 inches, beginning 2013) El Capitan 10.11.3, Simple question here: I can't open FinalCut Express (4, I believe). The wheel turns for hours. How can I install/uninstall and will I lose all my old films (for the most part stored on external hard drives). Thanks for your suggestions.

    You will not lose anything, but the app if you uninstall. If you decide to uninstall use this app to make sure that all the other files which depends on FCE are also deleted however I can't give you any assurance as to whether you will be able to reinstall so that it works correctly. It is a software that has not been supported for almost 5 years and there are conflicting reports as to its compatibility with OS X 10.11. Can't I test it myself.

    Maybe someone else will chime in with their own experiences.

    Russ

  • Why? on EACH web search I get a message saying "Firefox prevented this website." These are sites of trust for the most part

    I rebooted the free version of the Firefox browser, about two months ago. Since then, whenever I navigate, with few exceptions, Firefox displays a message bar at the top of the screen saying "Firefox prevented this site" with the message, there is a checkbox asking ' ALLOW? When I check ALLOW it most of the time, I get a web page, BUT on some occasions, Firefox keeps just block the page.
    Sites and pages that I refer here are for the most part, places of TRUST.
    This happened since I rebooted. It was NOT a problem before that.
    It is VERY annoying and I have since passed to Google Chrome.
    If you can offer any reasoning or explain why this is happening, I will be grateful.
    Thank you. mLowe51

    Finally looks like a response to the blocking of the Government and other trusted sites

  • Computer laptop HP DV6 freezes when on the power of the battery, for the most part using Firefox. Looking for help in debugging

    Is there anywhere I can look to see what is running or happening when my PC crashes?

    BACKGROUND:

    My PC has been freezing more frequently lately.

    It seems to happen more often when I am on battery, usually when I am online using Firefox my default browser.

    I tried checking the event viewer, but did not find much, and do not know, I am interested in the right part.

    I can say without a doubt it happens when it is on battery power, almost never when it is plugged.

    In addition, it seems to happen more frequently when I use Firefox, but then I'm usually just surf when I'm on battery.  When I don't really work, I tend to sit at a desk and connect.

    Here are my specs:

    HP Pavilion dv6-3120us laptop

    Product number: XG871UA

    OS: Windows Home Premium Service Pack 1

    Browser: Firefox Chrome for the most part, other times

    I'm starting to capture when / where it happens the more frequntly in a strive to locate the problem.

    I'll try to turn off Firefox addins / extensions as a first step, but would like any other tips.

    Thank you!
    Ian

    I did a quick check this week, surfing on the battery while using Firefox, I fell two times.  Once run it normally, first with all add-ons disabled.

    When I switched to Chrome I had any problems.

    I'll close this and call it a problem of Firefox, I'll open a new ticket if it appears elsewhere.

    But I'll check the both battery test.

    Thank you!
    Ian

  • Color laserjet 4600 - problem with one color (yellow) for the most part does not print

    Colors look purpleish when printing photos.  It turns out that this is a problem with yellow print.

    We tried to replace the yellow toner cartridge, and it was not fixed.

    PQ troubleshooting, the yellow page is empty except for a thin (16th of an inch) to 99% a horizontal line at the top of the page.

    In the configuration page, all the different areas that should have the yellow are mostly empty, with the exception of the same sort of thin horizontal line at the top of each of these areas.  After updating the firmware from 03.001.0 to 03.016.0: in addition to what is described on the configuration page, some of the fields in the configuration page that should be yellow, have a pale magenta and more this yellow line.

    Our technician came several times and has so far tried to replace the hvps, scanner laser, toner alignment and trainer kit Board.  Nothing has improved the question.  Then for the replacement is the regulator dc ($1000).

    Anyone here have an opinion on what could cause this problem?  It seems they are just throwing parts at home and we're about to tell them to give up.

    It wasn't the dc controller.  I figured out well out - somehow, there was a spring missing behind one of the speeds in the train of drum roll.

  • Short and simple question - automatic update for the most part

    Hello

    I just inherited three installations of Essentials. Is anyway to get ESXi hosts updated automatically as if it was possible with the Update Manager and the other versions of vSphere?

    See you soon

    AWo

    Because of the limited edition of Essentials functions, I'm afraid you'll have to patch update / hosts interactively. Same Update Manager is perhaps not very useful, because Essentials does not support the vMotion/DRS, and should not be any power on VM on the host to remedy. You will also need to find a workaround for the ESXi host on which vCenter Server runs, except the server instances vCenter for each Kit are run on hosts of the other Kit.

    André

  • MAC mini (late 2012) OS 10.11.6 intermittently has no video. CK of hardware is ok. Computer chimes and the light, no video. Close and wait a while for the most part solves the problem. Monitor is ok.

    Mac mini (late 2012) OS 10.11.6 intermittent video on turn on. Only when you quickly turn off. Lights, chime occurs, but the video remains black. Monitor is ok. Usually can recover if it is closed for a while, then restarted. Verification of the material is good. (extended) First aid disk shows no problem.

    Any ideas?

    Have you tried another cable?

    Another monitor?

  • I can't get my Zapotecs theme to show on my desktop. I have a white box for the most part empty and only a small strip on the left of my screen which has something on this. How should I do?

    My office does not display my theme Zapotecs, I'm especially a big box empty white to the right and Center, and a bunch on the left who is not white white. How to be the Zapotecs full desktop theme on my screen?

    You can view other themes on your system?

    If so, try to get a new theme "Zapotec" and try again.

    If this is not the case, check that the Windows themes service is enabled and running.

    Use the following steps to check if your themes service is enabled:

    1. open your Start Menu, and then click Run
      
    2. type in: Services.msc
      
    3 locate the themes service in the list of services and double-click it.
    4. set the startup type on: automatic
      
    5. click on apply, then Startand OK

    Try your theme.

    If the other themes of work, but can't always the Zapotec theme to work, then most likely it is corrupt.

  • How to calibrate the screens of Adobe products? For the most part, I'll use Illustrator and Photoshop.Can someone make a difference between the calibration and the Hardware calibration software using (Spider)? Thank you.

    How to calibrate the screens of Adobe products? I will mostly use Illustrator and Photoshop.Can make all the difference between calibration and the Hardware calibration software using (Spider)? Thank you.

    I use U2415 from Dell.

    I use the Spyder Pro 4. The process is quite simple - install the software, plug the Spyder and follow the steps listed in the program. I would recommend also, install the latest version of the software directly from the site of Datacolor instead to install from the disc supplied (probably outdated).

    Benjamin

  • The Office Word 2011 keyboard is all mixed up. However, for the most part, on Excel and the drafting of this help topic. Can you help me please?

    The keyword of Office Word mac is all mixed up. However in excel are more in their own as well as what I write today. Can you help me please?

    Mac OS 9 is 16 years old.  I asked that your post moved to the forum of Mavericks, since that's what you have published in your signature.

  • I can't launch the scanner after ive downloaded and or for the most part. What I am doing wrong?

    I don't know even what happened to my unit.  It was working fine, then I tried to send some documents in JustCloud to get space on the myhard drive.  All myicons then turned to the sheet of paper, and I can not cannot hardly straighten out such things. If I take it to someone to fix it, I'll never know what happened.  They do not give you their secrets, but of course they will charge you!

    You have an anti-malware protection, you can run analyses?  See thread of Vincenzo Di Russo on some good suggestions on ensuring that your system is clean of the infection: http://answers.microsoft.com/en-us/windows/forum/windows_vista-security/how-to-get-rid-of-malware/ba80504b-61f1-4d71-960f-b561798b7b42

  • Can I transfer dvd to hard drive tv programs or a memory stick? My os is Vista professional. DVD seems to be for the most part, the VR formatted on modern dvd recorders.

    I want to archive TV shows that were recorded on DVD that is formatted in VR mode rather than in video mode. My operating system is Vista business and therefore does not include the Media Center. I can play DVDs on the computer, but cannot transfer files from their hard drive. Windows Explorer does not work unless the DVD are formatted in video mode.

    Hi GeoffreyHawkins,

    This feature is not supported by Windows.

    However, you can use your favorite search engine & download any third-party software that could serve the purpose.

    Note: This response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there.

    Hope the helps of information.

  • My e-mail toolbar icons are for the most part disappeared (2 are still there, the rest is showing empty boxes) what can I do to restore it?

    Anyone able to help get the icons of my return to the e-mail toolbar?

    Click view > customize toolbar > drag the default toolbar in your toolbar (or drag the tools you need)

    EDIT: To post your picture, completely exit Mail, then restart the computer.

    If it looks like still wobbly, do a Boot secured and open Mail there.

  • Try the following: where is my profine stored? It will take you to non-existing buttons etc. It is for the most part iof support.

    This is a general problem: 'help sysytem' structure has been changed (perhaps in part I dion can't Koe) then the flow of questions from the ends up to non-existent (existing is more..) tips, suggestions, or instructions set how, not more existing or operating.
    Very frustrating.
    I raise my profile under Linux on the terminal with something like "find - name *.mab"and got it in a split second." None of the ways suggested later in the help worked!
    This is a general question for site designers, thanks for help [actually: it's the Help menu...]. Welcome,
    Giancarlo.
    Please follow the trail of help: you will get what I say, sorry. g.

    @Zenos. Thank you very much for your screenshot, which solved the issue.
    I have a Tundebird for Linux version, which, as far a s I see, is somewhat different from what you have. The previous version had not all submenus as you show, however, he recent update I made 'my' Thunderbird earned him almost to what you posted simply we had different programs.
    I suggest that it closed the thread. Thaks to all to help.
    Giancarlo.

  • 8.6.1 in lv 2009 update, missing lv vi, for the most part DAQmx errors

    I created an application with LV 8.6.1.   I have two 8.6.1. and lv 2009 on this computer.  When I click on the shortcut, lv 2009 automatically tries to load the application and gives me errors because it cannot find the sub live, for most of the screws of DAQmx.

    1 - is there a way I can get the shortcut to automatically load lv 8.6.1?

    2 are there in fact files I am missing that prevents the application from loading in LV 2009?

    I don't know what shortcut you are talking about. If it is a shortcut to the exe file, neither 8.6.1 or 2009 will begin. If you have a shortcut to a project or VI, then the version of LabVIEW that you last started will be charged. Just manually start 8.6.1, close it and next time 8.6.1 will begin.

    LabVIEW 2009 requires you to install DAQmx. You have a version compatible with your distribution of 2009. You can also download 8.9.5 or version 9.0.0.

Maybe you are looking for