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

Native Development

Reply
New Contributor
mbouksim
Posts: 8
Registered: ‎11-05-2012
My Device: test
Accepted Solution

Global varianl on QML and Js

hi every body

i have a question about how to creat a global variable shared between all the QML files i used to add this line 

.pragma library

 on the JS file and it works perfectly (on Descktop or Symbian application) but it seems doesn't existe on BB10

so is there any equivalent of this solution

 

thanks in advance :smileyhappy:

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Global varianl on QML and Js

That works perfectly well in Cascades QML stuff. I'm using it in many places.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Contributor
mbouksim
Posts: 8
Registered: ‎11-05-2012
My Device: test

Re: Global varianl on QML and Js

do i have to include somthing? beceause it dosn't work for me :s (i get it underlined in red :smileytongue:)

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Global varianl on QML and Js

"Underlined in red" is presumably from Momentics? I don't use Momentics so I don't see that. My own text editor, of course, doesn't underline it in red. ;-)

Whether it works or not in the actual device isn't dependent on whether Momentics (perhaps mistakenly) shows it as a problem. Try using it in your code and see if it works... that's the only real test, unless Momentics is actually preventing you from building when that red underlining is present...

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Contributor
mbouksim
Posts: 8
Registered: ‎11-05-2012
My Device: test

Re: Global varianl on QML and Js

thaanks a lot peter
it works :smileyhappy: