465 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+5 more
uiuxaesthetics says

Hey guys, I’ve been using bulkloader for a while now and love it, Im probably gonna switch over to the new GS one soon but not today. Anyone know how to load multiple instances of the same swf on a page. I have a swf that is heavily XML editable and want to show multiple occurrences of the same swf on a page. Anyone done this before?

567 posts
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
radykal says

Yes, change!!

But you can do something like that. Create multiple add methods for the bulkloader instance with different keys:

//load all assets
var bulkLoader:BulkLoader = new BulkLoader();
bulkLoader.add("mainSwf.swf", {id:"swf1"});
bulkLoader.add("mainSwf.swf", {id:"swf2"});
bulkLoader.add("mainSwf.swf", {id:"swf3"});
bulkLoader.addEventListener(BulkProgressEvent.COMPLETE, assetsLoaded);
bulkLoader.start();

 function assetsLoaded(evt:BulkProgressEvent):void
{
//save each swf in a separate variable
var swf1:Movieclip = bulkLoader.getMovieClip("swf1");
var swf2:Movieclip = bulkLoader.getMovieClip("swf2");
var swf3:Movieclip = bulkLoader.getMovieClip("swf3");
}

I think this should work, but no guarantee. I dont test it. Let me know.

111 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
savorks says
pack whole extend swf into a Class and
loaderInfo.applicationDomain.getDefinition(className);

?

or maybe create multiple LoadingItem load same url but assign different id ( working like create multiple Loader load same URL , their content will be different instance ), but I think this will waste lots memory compare to the extract Class method.

EDIT . Oops one minute slower :S

465 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+5 more
uiuxaesthetics says

Thanks guys!

@radykal that works and may be the solution I will use, only drawback is when I trace(event.bytesTotalCurrent); It actually loads the same swf twice instead of realizing its already been loaded

@savorks have no idea how to use the extract Class method, but that definitely is best way to do it for efficiency.

567 posts
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
radykal says

Yes, how get each flash movie the path of the xml file?

111 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
savorks says
This will get Class from a loaded MovieClip which loaded by BulkLoader.
var fileId:String = 'ExtendSwfFileId';
var className:String = 'ClassNameInExtendSwf';

var movieClip:MovieClip = bulkLoader.getMovieClip(fileId);
try
{
  var AClass:Class = Class(movieClip.loaderInfo.applicationDomain.getDefinition(className));
}
catch (er:Error)
{
  throw new Error('Can not find definition ' + className + ' from asset (id = ' + id + ' ).');
}

var newInstance:* = new AClass();

Hope it helps :)

465 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+5 more
uiuxaesthetics says

@savorks wow! wasn’t expecting that. Perfect solution, thanks so much!

111 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
savorks says

No problem mate :)

And for additional trick, if extend SWF have document class(in Flash IDE , just provide document class name, .as file isn’t necessary), you can use that class name for getting whole SWF ’s class definition.

I was hoping we can use “MainTimeline” (default constructor name of main timeline) for getting definition through a swf which doesn’t have document class, but can’t :S, maybe there is some others way to do it.

by
by
by
by
by
by