Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 30
Registered: ‎02-06-2012
My Device: Blackberry Playbook, Blackberry Torch
My Carrier: AT&T
Accepted Solution

SLOW Animations on a very simple game/app. runs great on PC

Hello. ive made a simple childrens application. You click an animals and a person calls out the name of the animal. 

when you click the animal, it increases in size to take up the whole screen. you can click it again to reduce it back to normal size.

 

On the pc when I test the movie, it runs great, however if i load the SWF or .bar to the playbook, its runs VERY slowly and choppy. 

 

Would anyone mind taking a look at my source or offering any advice that can help me track down the cause of the speed issues?

Developer
Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Re: SLOW Animations on a very simple game/app. runs great on PC

just curious... do you have this in your YourAppName-app.xml configuration file to tell the app to use the GPU to enhance rendering performance?

 

 

<initialWindow>

   <renderMode>gpu</renderMode>

</initialWindow>


PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****
Developer
Posts: 30
Registered: ‎02-06-2012
My Device: Blackberry Playbook, Blackberry Torch
My Carrier: AT&T

Re: SLOW Animations on a very simple game/app. runs great on PC

no it says "auto"

ill try that, thanks!

would that affect the SWF file as well, or only the .bar file
Developer
Posts: 30
Registered: ‎02-06-2012
My Device: Blackberry Playbook, Blackberry Torch
My Carrier: AT&T

Re: SLOW Animations on a very simple game/app. runs great on PC

whoa with rendermode as gpu it runs even SLOWER

not only that, some parts of the animations disappear
Developer
Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Re: SLOW Animations on a very simple game/app. runs great on PC

yikes, that's weird... can I ask how you are doing the animations?... maybe there is some unoptimized code in there...

e.g. got a code sample?

 

Are you using thecaurina.transitions to do your animations? I've found they work quite well.


PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****
Developer
Posts: 30
Registered: ‎02-06-2012
My Device: Blackberry Playbook, Blackberry Torch
My Carrier: AT&T

Re: SLOW Animations on a very simple game/app. runs great on PC

im using flash professional CS.5

 

the animations are a classic tween.

each animals is its own mc. cow_mc for example

keyframe 1 is the animal in its regular size 

layed all the animals out on the stage and tied them together in an array and made them all clickable with this code (which also brings the animals to the front so that when they are clicked nothing overlaps it)

var animals : Array = [pig_mc, chicken_mc, rabbit_mc, donkey_mc, sheep_mc, horse_mc, goat_mc, frog_mc, duck_mc, cow_mc]

for (var i:int = 0; i< animals.length; i++){
	animals[i].addEventListener(MouseEvent.CLICK,bringToFront);
	animals[i].addEventListener(MouseEvent.CLICK,mc_play);
	animals[i].buttonMode = true;
}

function bringToFront (e:MouseEvent) {
	setChildIndex (DisplayObjectContainer(e.currentTarget), numChildren - 1);
	
	
}

 

Now this is the code that listens for a click on any of the MC's. on click, the playhead IN the mc will start to play, either to the enlarge (classic) tween or to the shrink (classic) tween.

at the same time, it checks to see if a flag has been set for spanish or english and tells a movie clip INSIDE cow_mc (for example) to say "i see a cow" or "yo veo una vaca"

ALSO, depending on which flag is set, a sound will play identifying the animal, either in spanish or english

 

function mc_play(e:MouseEvent)
{
	 if(isSpanish)
	 {if (e.currentTarget.currentFrame == 1) 
    { 
        e.currentTarget.gotoAndPlay("spanish");
		flash.media.SoundMixer.stopAll()
		question_mc.visible = false;
    } 
    else 
    { 
        e.currentTarget.gotoAndPlay("return");
		flash.media.SoundMixer.stopAll()
		question_mc.visible = true;
		setChildIndex (DisplayObjectContainer(e.currentTarget), 14);
    } 
	 }
	 else
	 {if (e.currentTarget.currentFrame == 1) 
    { 
        e.currentTarget.gotoAndPlay("english");
		flash.media.SoundMixer.stopAll()
		question_mc.visible = false;
    } 
    else 
    { 
        e.currentTarget.gotoAndPlay("return");
		flash.media.SoundMixer.stopAll()
		question_mc.visible = true;
		setChildIndex (DisplayObjectContainer(e.currentTarget), 14);
    } 
	
}
}

 

Developer
Posts: 30
Registered: ‎02-06-2012
My Device: Blackberry Playbook, Blackberry Torch
My Carrier: AT&T

Re: SLOW Animations on a very simple game/app. runs great on PC

[ Edited ]

i'll admit i dont know what this part does
(var i:int = 0; i< animals.length; i++)

 

looking up caurina transitions now

Developer
Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Re: SLOW Animations on a very simple game/app. runs great on PC

on my way to run errands so I'll look later but the "for" loop does the following (in words)

 

 

do a for loop...

    starting at zero,

       adding 1 for each loop

           until you reach the length (size of) the list of animals

 

thus every animal gets a mouse click listener added to call "bringToFront" and "mc_play" and for the animal to "behave" like a button.


PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****
Developer
Posts: 30
Registered: ‎02-06-2012
My Device: Blackberry Playbook, Blackberry Torch
My Carrier: AT&T

Re: SLOW Animations on a very simple game/app. runs great on PC

well, my girlfriend had done all the art and had gone crazy with the symbols and layers. i consolidated them into a single layer for the background and a couple for the foreground and that helped alot