Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > CopperCube Open discussion
CopperCube 4.01 Flash loses SimpleAPI hook

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


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.


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.


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

Thanks for the words gentlemen, will do.
mrdeli


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:


Posted by: (you are not logged in)


Enter the missing letter in: "?nternational" (you are not logged in)


Text:

 

  

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


   






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