01-05-2013 05:43 PM
Hi everyone, I have an issue I'm getting on both my VM bb10 and Dev Alpha (upgraded with the recent OS upgrade in late november: Autoload-DevAlpha-10.0.09.1103.exe). Based on the fact I am trying to create 2 seperate versions of a hopefully awesome app I'm developing just for Blackberry, I did what someone in another thread mentioned to do (sorry I forget the person's name) and I am using direct library links and not including SDK automatically based on platform so I can develop variations of a BB10 and PB version at roughly the same time. I am using FB 4.6 as part of CS6. I tried to go with 4.7 but I gave up because 4.6 is still working just fine for me.
This approach worked outstanding for my previous PB app that I published and allowed me to still have a seperate project that work (at least initially) properly with BB10.
However, the second I change to the BB10 sdk 3.0 libraries and referrence those files it fails for me with this:
TypeError: Error #1007: Instantiation attempted on a non-constructor. at qnx.fuse.ui.theme::ThemeWhite/createCSS()[E:\hudson\workspace\BB10_0_04-AIR_SDK_API\src\qnxui\src\qn x\fuse\ui\theme\ThemeWhite.as:25] at qnx.fuse.ui.theme::ThemeWhite()[E:\hudson\workspac e\BB10_0_04-AIR_SDK_API\src\qnxui\src\qnx\fuse\ui\ theme\ThemeWhite.as:20] at qnx.fuse.ui.theme::ThemeGlobals$/getTheme()[E:\hud son\workspace\BB10_0_04-AIR_SDK_API\src\qnxui\src\ qnx\fuse\ui\theme\ThemeGlobals.as:246] at qnx.fuse.ui.theme::ThemeGlobals$/lookupStyle()[E:\ hudson\workspace\BB10_0_04-AIR_SDK_API\src\qnxui\s rc\qnx\fuse\ui\theme\ThemeGlobals.as:189] at qnx.fuse.ui.theme::ThemeGlobals$/lookupValue()[E:\ hudson\workspace\BB10_0_04-AIR_SDK_API\src\qnxui\s rc\qnx\fuse\ui\theme\ThemeGlobals.as:201]
This has happened to 2 seperate very simple applications I have tried to use. One where the said code below in question was placed on a Sprite and another where it was placed on a Container control.
As background, here are the other important settings:
Libraries included:
Flex 4.6.0
*Air Global.swc
*core.swc
*osmf.swc
*textLayout.swc
*servicemonitor.swc
Referenced Libraries
*qnx-air.swc - C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs
*blackberry.swc - C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs
*qnxmedia.swc - C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs
*qnxui.swc - C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs
*QNXSkins.ane - C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.0.0\frameworks\libs
I also have included the other 3 ANE files and have made sure they are included with a checkbox for the build.
Here is the includes:
(Rest of .ane files in qnx ane folder are also loaded with same path)
And here is the base code I'm taking from the examples:
Includes:
import qnx.fuse.ui.buttons.Button; import qnx.fuse.ui.buttons.LabelButton; import qnx.fuse.ui.buttons.SegmentedControl; import qnx.ui.data.DataProvider; import qnx.fuse.ui.text.TextFormat; import flash.text.TextFormatAlign; import qnx.fuse.ui.skins.SkinStates;
And code that actually fails when trying to generate this:
var buttonArray:Array=[];
buttonArray.push({label:"AM"});
buttonArray.push({label:"FM"});
buttonArray.push({label:"HD"});
// create a segemented control
var mySegment:SegmentedControl = new SegmentedControl();
mySegment.x = 200;
mySegment.y = 200;
mySegment.width = 200;
// set the data provider
mySegment.dataProvider = new DataProvider(buttonArray);
// set the selected index to be the 3rd item in the dataProvider
mySegment.selectedIndex = 2;
// add the control to the display list
stage.addChild(mySegment);
var myButton:LabelButton = new LabelButton();
myButton.label = "Click here yo!";
stage.addChild(myButton);
This fails with either control commented out but does not fail when both are commented. Do I need to still include some of the SDK 2.1 files? Am I just missing something mega obvious? Hopefully I am. ![]()
Thanks for any help!
01-05-2013 06:03 PM
01-05-2013 06:17 PM - edited 01-05-2013 06:18 PM
No I do not have any of the SDK 2.1 libraries in this case. I luckily learned my lesson a while back for not having the following code there to prevent null stage:
<main app class>
{
.....
addEventListener(Event.ADDED_TO_STAGE,handleAddedT oStage);
}
private function handleAddedToStage(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE,handleAdd edToStage);
// stage is avail, we can now listen for real events
initializeUI();
}If anything I may have to just settle for 2.1 dev for now and just forget about trying to be a "good" app that will fall under the 10k and other numerous benefits that BB has put out for us.
01-05-2013 07:35 PM
Oh sorry I didn't answer the last part. I did some more research. It looks like it's crashing even when I simply declare a variable as say a segmented control. So my guess is, it's failing when it loads the SDK libraries because if I gather correctly from everything, flash only includes/loads libraries when it's actually used (such as a variable etc).
01-05-2013 08:21 PM
01-05-2013 09:27 PM
First, before I answer, thanks a lot helping me try to work this through.
As for the project, it's completely 100% new. Create project, add SDK 3.0 referrences when creating the project and adding those small snippets of code. I had the same issue with another project i had earlier so I decided to start completely new in case i'm doing something wrong. But followed everything according to everything i've read and it still fails. Maybe this is ok for now, can you tell me how much improved 3.0 is vs 2.1?
Thanks again.
01-06-2013 09:36 AM
01-06-2013 09:51 AM
The following worked fine:
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import qnx.fuse.ui.buttons.LabelButton;
import qnx.fuse.ui.buttons.SegmentedControl;
import qnx.ui.data.DataProvider;
public class SampleApp extends Sprite
{
public function SampleApp()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
this.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage );
}
private function handleAddedToStage(e:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
this.initUI();
}
private function initUI() : void
{
var buttonArray:Array=[];
buttonArray.push({label:"AM"});
buttonArray.push({label:"FM"});
buttonArray.push({label:"HD"});
// create a segemented control
var mySegment:SegmentedControl = new SegmentedControl();
mySegment.setPosition( 200, 200 );
mySegment.width = 400;
// set the data provider
mySegment.dataProvider = new DataProvider(buttonArray);
// set the selected index to be the 3rd item in the dataProvider
mySegment.selectedIndex = 2;
// add the control to the display list
stage.addChild(mySegment);
var myButton:LabelButton = new LabelButton();
myButton.label = "Click here yo!";
stage.addChild(myButton);
}
}
}
Personally, All UI elements should go into a "page" and pages added and removed to the root display and not the stage. Above code the addChild(...) calls should use "this" instead of "stage" so the elements are being added to the root sprite and not directly to the stage.
01-06-2013 09:52 AM
01-07-2013 02:44 AM
Yeah, I just didn't really take notice on the simulator. I launched 2.1 on the dev alpha and wow, this is going to cause problems. I couldn't even really use it it's so small. I am going to look into a full reinstall of flash and the SDK's with completely new projects (only my RIM keys will be kept). Hopefully this works, and if I cannot fix this and/or resize the controls for the different resolution, I may have to end up making my own controls for certain things.
It's the weekend, but was hoping one of the RIM genies could shed some light on it. Thanks again jtegen, you have helped a lot of the people i have noticed on these forums. ![]()