Skip to main content
Participant
September 17, 2013
解決済み

Button issue

  • September 17, 2013
  • 返信数 2.
  • 949 ビュー

hello,

I'am new in as3 programming,

I use this code and there is nothing displayed on the screen.

package

{

import flash.display.Sprite;

import flash.display.Graphics;

import flash.events.Event;

import fl.core.UIComponent;

import fl.controls.Button;

public class Main extends Sprite

{

public function Main():void

{

init();

}

private function init ():void

{

var myButton:Button = new Button();

myButton.emphasized = false;

myButton.width = 150;

myButton.move(20, 20);

addChild(myButton);

}

}

}

Help me please.

このトピックへの返信は締め切られました。
解決に役立った回答 Ned Murphy

I just noticed in your code that you disable the border by using:

myButton.emphasized = false;

change that if you want a border around the button.

返信数 2

Ned Murphy
Ned Murphy解決!
Legend
September 18, 2013

I just noticed in your code that you disable the border by using:

myButton.emphasized = false;

change that if you want a border around the button.

Ned Murphy
Legend
September 17, 2013

1) The code you show needs to be placed in an Actionscript class file named Main.as.  

2) You need to specify "Main" as the document class in the Properties panel of your Flash file so that it uses the Main.as file for its code

3) You need to place a Button component in the library of the Flash file - do this by dragging one from the Components library to the stage, then delete it from the stage - it will be retained in the library after that

ACYLINUX作成者
Participant
September 17, 2013

thank you for your reply, i already did the first ans second request you wrote.

but for the third it doesn't work. I run the programm it works bur it display only a text: Label without any border of button.

PS: iam using flash develo 4.3 and for the fl.control library i downloaded the fl.swc library. i copyed in the lib folder.

Ned Murphy
Legend
September 17, 2013

"Label" is the default label for a Button component.  I am not familiar with whatever other component library you might be using so that might be where your problem lies... it might be the button doesn't resemble what you expect?

Try assigning a label title to the button.  If the label you describe shows that text then there's your Button displayed on the screen - problem solved...

       myButton.label = "Some Text";