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
agaripian
Posts: 133
Registered: ‎12-02-2010
My Device: Z10 & Dev Alpha C

Adding Flex Components to Action Script Mobile Project

I am trying to add flex components MX or SPARK to an actionscript mobile project - I know this defeats the purpose of the action script mobile project... 

 

Was any one able to achieve this? Here is a very simple example of what I tried. 

Was anoy one able to bootstrap the Flex SDK into a action script mobile project?

 

package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	
	import mx.controls.Button;
	import mx.core.UIComponent;
	
	import qnx.fuse.ui.buttons.LabelButton;
	
	import spark.components.Button;
	
	public class TestActionScriptAS extends Sprite
	{
		public function TestActionScriptAS()
		{
			super();
			
			// support autoOrients
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			var uiComp:UIComponent = new UIComponent();
			uiComp.height = stage.height;
			uiComp.width = stage.width;
			addChild(uiComp);
			
			var testMXButton:mx.controls.Button = new mx.controls.Button();
			testMXButton.width = 200;
			testMXButton.height = 40;
			testMXButton.y = 0;
			testMXButton.label = "test MX";
			//Nothing is displayed error is not thrown
			addChild(testMXButton);
			
			var testSparkButton:spark.components.Button = new spark.components.Button ();
			testSparkButton.width = 200;
			testSparkButton.height = 40;
			testSparkButton.y = 100;
			testSparkButton.label = "test Spark";
			//Nothing is displayed error is not thrown
			addChild(testSparkButton);
			
			var testQNXButton:qnx.fuse.ui.buttons.LabelButton = new qnx.fuse.ui.buttons.LabelButton()
			testQNXButton.width = 200;
			testQNXButton.height = 40;
			testQNXButton.y = 200;
			testQNXButton.label = "test QNX";
			//QNX Button is displayed properly!!!!!!!
			addChild(testQNXButton);
			
			
			
			//THis throws the following error: (See below comment)
			uiComp.addChild(testMXButton)
				
			/*TypeError: Error #1009: Cannot access a property or method of a null object reference.
			at mx.styles::StyleManager$/getStyleManager()[E:\dev\4.y\frameworks\projects\framework\src\mx\styles\StyleManager.as:139]
				at mx.styles::StyleProtoChain$/getStyleManager()[E:\dev\4.y\frameworks\projects\framework\src\mx\styles\StyleProtoChain.as:1016]
					at mx.styles::StyleProtoChain$/initProtoChain()[E:\dev\4.y\frameworks\projects\framework\src\mx\styles\StyleProtoChain.as:149]
						at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::initProtoChain()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:10926]
			at mx.core::UIComponent/regenerateStyleCache()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:10989]
				at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::addingChild()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7465]
			at mx.core::UIComponent/addChild()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7162]
				at TestActionScriptAS()[C:\Users\DJ\Adobe Flash Builder 4.6_new\TestActionScriptAS\src\TestActionScriptAS.as:54]*/
			
			
		}
	}
}

 

---------------------------------------------------------------------
Developer of Stocks for Blackberry 10
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Adding Flex Components to Action Script Mobile Project

Did you include the skin ANE?
Please use plain text.
Developer
agaripian
Posts: 133
Registered: ‎12-02-2010
My Device: Z10 & Dev Alpha C

Re: Adding Flex Components to Action Script Mobile Project

Yes I included the QNXSKINS.ane in the Native Extensions and packaged it with the application. If you dont package it you get a different error stating: VerifyError: Error #1014: Class IFlexDisplayObject could not be found

---------------------------------------------------------------------
Developer of Stocks for Blackberry 10
Please use plain text.