bennyxqg / bulk-loader

Automatically exported from code.google.com/p/bulk-loader
0 stars 0 forks source link

Event type conversion problem... #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hallo I am having a strange problem with the Bulk Loader. Here are the
steps that i go through when loding the assets that I need.

////////// 1 ///////////

//create instance of bulk loader and add all 
//button graphics and first teaser graphic
private function loadAssets():void{ 
    _bulkLoader = new BulkLoader("startteaser");
    _bulkLoader.logLevel = BulkLoader.LOG_INFO;

    for each (var i:XML in _configXML.card){
        var closedGraphicID:String = String(i.closedGraphic.attribute("src"));
        _bulkLoader.add(closedGraphicID);

    }

    var firstTeaserID:String =
String(_configXML.card[0].child("openGraphic").attribute("src"));
    var firstTeaserType:String = firstTeaserID.substr(firstTeaserID.length -
3, 3);
    _bulkLoader.add(firstTeaserID);

    _bulkLoader.addEventListener(BulkLoader.PROGRESS, onStartupItemsProgress);
    _bulkLoader.addEventListener(BulkLoader.COMPLETE, startupItemsLoaded);
    _bulkLoader.start();
}

////////// 2 ///////////

//start loading of all other teasers and start film
private function startupItemsLoaded($e:BulkProgressEvent) : void{
    _bulkLoader.removeEventListener(BulkLoader.PROGRESS, onStartupItemsProgress);
    _bulkLoader.removeEventListener(BulkLoader.COMPLETE, startupItemsLoaded);

    for(var i:Number = 0; i < _configXML.card.length(); i++){
        var openGraphicID:String =
String(_configXML.card[i].child("openGraphic").attribute("src"));
        _bulkLoader.add(openGraphicID);

    }

    _bulkLoader.start();

    _layoutManager = new LayoutManager(_configXML);
}

////////// 1 ///////////

//check to see if teaser is already loaded
//if so draw teaser if not show loading
public function Teaser($teaserXML:XML, $totalCards:Number) {
    _bulkLoader = BulkLoader.getLoader("startteaser");

    if(_bulkLoader.hasItem(_teaserID) != false){
        draw();

    }else{
        showLoadBar();

    }
}

What steps will reproduce the problem?
1. Click any link in the flash teaser area
2. Return to the page with the back button in IE7 (this does not hapen on
all computers)

What is the expected output? 
All teaers should load.

What do you see instead?
For the 3 teasers that are loaded with in a second batch.

TypeError: Error #1034: Type change Failed: 
flash.events::Event@3c4d581 kann nicht in
br.com.stimuli.loading.BulkProgressEvent umgewandelt werden.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at br.com.stimuli.loading.loadingtypes::LoadingItem/onCompleteHandler()
at br.com.stimuli.loading.loadingtypes::ImageItem/onCompleteHandler()

What version of the product are you using? On what operating system?
Buld Loader 1.9.6,  XP IE7

Original issue reported on code.google.com by greg.ja...@gmail.com on 28 Apr 2008 at 1:34

GoogleCodeExporter commented 9 years ago
this error seems to go away when you change 

private function startupItemsLoaded($e:BulkProgressEvent) : void

to

private function startupItemsLoaded($e:Event) : void

Original comment by greg.ja...@gmail.com on 30 Apr 2008 at 7:58

GoogleCodeExporter commented 9 years ago
Hi Greg Jacob.

This does work as expected from trunk. The stack trace in German is not helping 
me
much ;-).

I need more info to make sure this is some issue in BulkLoader , basically:
a) A simple test case: create loader, add one item, add complete listener, 
listen to
event and catch error.
b) The stack trace in English, with the --debug flag on so I can spot where the 
cast
is failing really.

Else, it works as expected.

Thanks
Arthur Debert

Original comment by debert on 1 May 2008 at 6:53

GoogleCodeExporter commented 9 years ago
I have found the sollution to the problem:

BulkLoader.PROGRESS is a BulkProgressEvent

and 

BulkLoader.COMPLETE is a normal AS3 Event

I had assumed that COMPLETE was also a BulkProgressEvent since it had to do 
with progress.

Thanks

Greg

Original comment by greg.ja...@gmail.com on 5 May 2008 at 4:02

GoogleCodeExporter commented 9 years ago

Original comment by debert on 5 May 2008 at 4:06