If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
New Developer
richardyiu
Posts: 17
Registered: ‎01-14-2011
My Device: Not Specified

Default package & View

Hi everyone,

 

I am new to Flash builder and I have read the tutorial on creating playbook app using Flash builder.

In the tutorial, I see that we are using action script instead of mxml.   I tried to add a button using action script but nothing shows in the simulator (I only see a white screen).   It is because the mxml file under the views folder is taking control?

 

If I am using action script file, do I need to delete the Home.mxml that is under the views folder? 

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

Re: Default package & View

Welcome:

 

In posts like this, it is best to post code or sample code to illustrate the issue. The majority of time, your issue can be quickly resolved if others can see the code.

 

Couple of questions:

  • What button class are you using?
  • Are you using addChild to add the button to the containing class?

 

In a pure AS project, your root item would be an .as file too and not an MXML file.  When creating the project with the wizard, the last panel will show the default/root class name.  In your case, that was probably "Home.mxml".  Simply rename that to "Home.as" and everything gets created properly.  If you already have a project, it is easier to delete it and create a new project.  Be certain to give your project a unique (reverse DNS) id (e.g. com.mydomain.home).  You can alwasy change it later, but you may as well do it here.

 

Hope that helps.

Please use plain text.
New Developer
richardyiu
Posts: 17
Registered: ‎01-14-2011
My Device: Not Specified

Re: Default package & View

I put the following code in my .as file and leave the Home.mxml file unchanged.  I am using  Burrito.

 

package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TransformGestureEvent;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.filesystem.File;
import qnx.dialog.*;
import qnx.display.IowWindow;
import qnx.ui.buttons.LabelButton;
import qnx.ui.core.*;
import qnx.ui.data.DataProvider;
import qnx.ui.listClasses.List;
import qnx.ui.listClasses.ListSelectionMode;
import qnx.ui.listClasses.ScrollDirection;
import qnx.ui.skins.SkinStates;
import qnx.ui.text.*;
[SWF(height="600", width="1024", frameRate="30", backgroundColor="#FFFFFF")]
public class Test2 extends Sprite
{
private var endButton:LabelButton;
public function Test2()
{
endButton = new LabelButton();
endButton.label = "Exit";
endButton.size = 100;
endButton.sizeUnit = SizeUnit.PIXELS;
endButton.sizeMode = SizeMode.BOTH;
endButton.addEventListener(MouseEvent.CLICK, endButtonOnClick);
}
public function endButtonOnClick(event:smileysurprised:bject):void
{
stage.nativeWindow.close();
}
}
}

 

project.jpg

Please use plain text.
Trusted Contributor
PBDev
Posts: 108
Registered: ‎12-28-2010
My Device: Free PlayBook
My Carrier: Verizon

Re: Default package & View

Try addChild(endButton); to add your button to the display list.

Please use plain text.
New Developer
richardyiu
Posts: 17
Registered: ‎01-14-2011
My Device: Not Specified

Re: Default package & View

thanks.  Now I see my button.  Back to my original question, what does the Test2Home.mxml do?

Please use plain text.
Developer
noahnu
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS

Re: Default package & View

[ Edited ]

I believe you want to be working with just ActionScript which means that you shouldn't have any MXML files in your project. What you can use a MXML file for though is to easily design the appearance of your application. Flash Builder provides a WYSIWYG editor for MXML.

 

EDIT: @jtegen how do you edit the reverse DNS name without creating a new project? (Flash Builder Burrito)

From,
Noah NU
Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Default package & View

@noah: In ur project list look for your -app.xml descriptor file. open that up and look for the ID tag. you can change that to anything you want.

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
Please use plain text.