ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > CopperCube Open discussion
forum topic indicator CopperCube 4.01 Flash loses SimpleAPI hook
person icon
mrdeli
Guest
Quote
2013-01-31 19:06:20

Hello,
We noticed this morning that any SWFs published in 4.01 (bought it yesterday, we can't seem to get a hook for simpleAPI - can anyone else confirm this)

coppercubeSprite = sceneLoader.content as DisplayObject;
simpleAPI = coppercubeSprite['simpleAPI'];

//simpleAPI is always Null in 4.01

person icon
erik
Registered User
Quote
2013-01-31 21:13:58

I think this changed a bit in CC4, the docs seem not to be up to date. You need to check
simpleAPI = coppercubeSprite['simpleAPI'];

later, until it is fully loaded. Like in a onGraphicsFrame callback. Then it works.

person icon
niko
Moderator
Quote
2013-02-01 10:12:08

Yes, that's true. Do a
addEventListener(Event.ENTER_FRAME, onGraphicsFrame);


And then do something like this:

// called when the coppercube .swf file has been loaded and initialized
private function onCoppercubeLoaded(e:Event):void
{
// get access to the simple API object:
coppercubeSprite = loader.content as DisplayObject;
loadingFinished = true;
}

// called every frame
public function onGraphicsFrame(event:Event):void
{
if (loadingFinished)
{
if (!simpleAPI && coppercubeSprite)
simpleAPI = coppercubeSprite['simpleAPI'];

if (simpleAPI && simpleAPI.isLoaded())
{
// ab hier ist alles ok
}
}
}


This is because of the new integrated preloader. The sprite is already there and active and doing something (displaying an animating the loading bar), but the simpleAPI isn't yet there because the file hasn't still loaded completely. So you need to check continuously.

The docs really need to be updated for this.

person icon
mrdeli
Registered User
Quote
2013-02-01 20:59:29

Thanks for the words gentlemen, will do.
mrdeli

person icon
Robo
Guest
Quote
2022-10-24 04:37:22

Is the above code by Niko usuable for a loading screen - percentage loaded amount ?...anyone ?


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |