• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Clarification needed regarding the Loader class

Explorer ,
Dec 08, 2008 Dec 08, 2008

Copy link to clipboard

Copied

Hi All,
I need a clarification regarding the Loader class available in the flash.display package. The Loader class is used to load SWF files or images. Loader itself has a constructor with no parameters. So, i used to make use of this constructor to create an instance of it. But, when i decompiled a flash file which i downloaded from a website, i found that, it uses a different kind of code to achieve something, which i am not able to understand. So, any of you please help me out in understanding this. The code scriplet can be found below my signature.

galleryImages which can be found in the parameter of the Loader code scriplet is a MovieClip.

Please let me know, what this piece of code does.


Thanks in advance,
Prabakaran Srinivasan.
TOPICS
ActionScript

Views

427

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 09, 2008 Dec 09, 2008

Copy link to clipboard

Copied

bytesloaded tells you how many bytes are loaded so far. To get that from a Loader you have to look at the loader's contentLoaderInfo.bytesLoaded. If you're checking an object already in the display list, you can't just say:

galleryImages.getChildByName("instance name").contentLoaderInfo.bytesLoaded

because the object in question might be a sprite or a shape, or even a textfield. By saying Loader(galleryImages.getChildByName("instance name")).contentLoaderInfo.bytesLoaded; you're letting Flash know to treat the object as a Loader.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 10, 2008 Dec 10, 2008

Copy link to clipboard

Copied

Hi Colin,
Thanks for the replies. I understood that and it was really helpful. I need another clarification on the instance creation of Loader class.

Is
var loader: Loader = new Loader();
is the only option to instantiate a loader class or is there any other means of achieving it.

Please let me know.

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 10, 2008 Dec 10, 2008

Copy link to clipboard

Copied

I can't think of another way of making one. What's the overall problem that you're trying to solve?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 10, 2008 Dec 10, 2008

Copy link to clipboard

Copied

LATEST
Hi Colin,
I am doing an academic project in which i am interpreting all the API s which uses URL as a parameter. I used to inject my own bytecode which contains a couple of classes into the existing flash file and i will replace the existing API calls which uses URL, to my own Class call or method call to have the control over the URL. I am doing this for Loader, URLLoader, navigateToURL, NetStream and so on. So, i just wanted to know whether there are any other possibilities for instance creation.

Thanks for the help.
Prabakaran Srinivasan.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines