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: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional
Accepted Solution

ToggleSwitch in Flex

I've been trying to get the QNX ToggleSwitch to work in Flex, but I don't think it's going to. It seems I'd almost have to do a Flex component and skin it to match the QNX styles.

 

Has anyone else tried this in Flex?

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: ToggleSwitch in Flex

[ Edited ]

Edit: See comantis's post below for solution!

 


 

hey johnp,

 

if this is like the other situations i've seen (and tested), it is most likely because the QNX Library was compiled against AS3 and not MXML. you will find that the display objects from the QNX library will not work straight out of the box with MXML. You will need to implement flex equivelents of those QNX components. here is a link to a thread with a little more detail:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Picker-List-Component-Not-Working...

 

hope that helps. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: ToggleSwitch in Flex

Yeah, the more I work with this, the more I realize as this app grows I'll be forced to migrate it into something a lot more native to the PlayBook, which will likely be a good idea anyways.

 

Thanks for the fast response JRab, I could probably skin a Flex toggle button to use similar color schemes for now, but it won't be a pretty slider. Smiley Happy

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: ToggleSwitch in Flex

hey johnp,

 

no problem at all! and yah i gotta say if i had started out with burrito id probably have gone down the MXML road but since i started out with Flash Builder 4, it wasnt as easy as it is now to program for the playbook via the MXML route. So i stuck with pure AS3. now that i look back im kind of glad i chose AS3. Although the MXML structure allows for an easy development by giving easier control over your components, i love the AS3 ability to customize and make an app from scratch.

 

im a control freak haha i like knowing whats happening and how. i refuse to use the QNX containers for that reason lol. but to each his own - whatever works for you best and is most convenient, go with that and perfect it!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: ToggleSwitch in Flex

Knowing NOTHING about development I started with Flash Builder 4 because that's what I had. Started out in the WYSIWYG mode, got it all laid out, but now have been working more in code view, almost exclusively - and maximized view no less.

 

Maybe some day I'll get to be halfway decent in AS3 or even be able to start from scratch, however right now I'm at least able to walk - someday I'll run. Smiley Happy

Developer
Posts: 1,003
Registered: ‎01-16-2011
My Device: PlayBook (sim)
My Carrier: Rogers

Re: ToggleSwitch in Flex

This topic was actually really good for me to read - I started with a flex example and was using mxml originally, and thankfully never ever could get design mode to work in Burrito, so I began to learn actionscript. I'm glad I did because even though I don't get to really layout my components, I feel like I'm able to see why things are happening and how I can control them (as JRab mentioned), and it really helps me as a new developer get a feel for the system.

- If you like my response/post, or it helped you find an answer you were looking for, please provide a Kudo - white star to the bottom right of this post. -
- Please use the search bar at the top, or check out the PlayBook FAQ's for help getting started -
- Hockey DrillBook -
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: ToggleSwitch in Flex

your last line kind of reminds me of the quote i stole from the first iron man movie and use almost everyday when someone tells me im doing something outrageous:

 

"Jarvis... Sometimes you have to run before you can walk."

 

at first glance its utterly ridiculous but then it makes a world of sense Smiley Happy

 

p.s. and yes im a HUGE iron man fan hah

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: ToggleSwitch in Flex

@jrab: You should change your avatar to an iron man icon.  You probably have a secret lab that you have all these machines coming up with sample code to share with everyone.  So "jrab" is not a single person, it is a hord of robotic arms coding for you.  It is all very clear now.

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: ToggleSwitch in Flex

[ Edited ]

darn it. i would have thought that i could have kept this charade up for a just a little while longer. but thats how the cookie crumbles!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Developer
Posts: 52
Registered: ‎02-15-2011
My Device: Not Specified

Re: ToggleSwitch in Flex

Personally, I am using flex, and just using the Blackberry controls where there is no suitable flex equivalent.  I am using the qnx toggle swtich in my code.  Here's how you can do it:

 

In your mxml (wherever you want the toggle switch to appear) add 

 

<mx:UIComponent id="toggleSwitchContainer" />

 

 

then in your initialize function (or wherver else) add:

 

 

var toggleSwitch:ToggleSwitch = new ToggleSwitch();
toggleSwitchContainer.addChild(toggleSwitch);

  you can then add event listeners etc.  This is working fine for me.

 

 For now I am doing this, however eventually I want to skin the hslider to make a Flex Toggle Switch.  Then I can port my flex app to other (Android) devices.