Jump to content
Search Community

Search the Community

Showing results for tags 'structure'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

Found 1 result

  1. Hello! Is it possible to load objects outside the "complete" events ( LoaderEvent )? Right now, it's like this: function initLoader():void { xmlLoader = new XMLLoader( "PathToXml/xml.xml", { onComplete:loadData } ); xmlLoader.load(); } function loadData( e:LoaderEvent ):void { loaderMax = LoaderMax.getLoader( "loaderID" ); loaderMax.addEventListener( LoaderEvent.COMPLETE, completeLoader ); loaderMax.load(); } function completeLoader( e:LoaderMax ):void { texture1 = TextureFromBitmapData( LoaderMax.getLoader( "image1" ).rawContent.bitmapData ); texture2 = TextureFromBitmapData( LoaderMax.getLoader( "image2" ).rawContent.bitmapData ); texture3 = TextureFromBitmapData( LoaderMax.getLoader( "image3" ).rawContent.bitmapData ); (...) } And it works, but I have to write this in every class of my app, not handy if I have to change something... That's why I wanted to create a "LoaderScreen" class, that I call where I need, with some methods to help me to handle all the assets / loaders. More or less like this: class LoaderScreen public function LoaderScreen( loaderId:String ) { xmlLoader = new XMLLoader( "xml", { onComplete:loadData } ); xmlLoader.load(); } private function loadData( e:LoaderEvent ):void { loaderMax = LoaderMax.getLoader( loaderID ); loaderMax.addEventListener( LoaderEvent.COMPLETE, completeLoader ); loaderMax.load(); } private function completeLoader( e:LoaderEvent ):void { // nothing here } // HELPERS -- public function loadBitmapdata( id:String ):BitmapData { return mainLoader.getLoader( "texParticleMenuHome" ).rawContent.bitmapData; } And now I want to create a LoaderScreen object, and try to load stuff: class Anywhere public class Anywhere() { var loaderScreen:LoaderScreen = new LoaderScreen( "myID" ); addChild( loaderScreen ); texture1 = TextureFromBitmapData( loaderScreen.loadImage( "image1" ) ); texture2 = TextureFromBitmapData( loaderScreen.loadImage( "image2" ) ); texture3 = TextureFromBitmapData( loaderScreen.loadImage( "image3" ) ); } But it returns "null" when I'm not in the "complete" event handler ( LoaderEvent ). trace( mainLoader.getLoader( "xxx" ) ) in the complete event return something trace( mainLoader.getLoader( "xxx" ) ) outside, return null It's a kind of "AssetsManager" I guess ( based on my framework ) but I only need to know how I can load stuff outside the LoaderEvent. If anyone can help me, or have a suggestion...! Thanks!
×
×
  • Create New...