Warning: include_once(/home/aswing/aswing.org/home/wp-content/plugins/wordpress-support/wordpress-support.php): failed to open stream: Permission denied in /home/aswing/aswing.org/home/wp-settings.php on line 261

Warning: include_once(): Failed opening '/home/aswing/aswing.org/home/wp-content/plugins/wordpress-support/wordpress-support.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/aswing/aswing.org/home/wp-settings.php on line 261
AsWing » 2008 » November

Archive for November, 2008

Vector renamed to ArrayList

November 7th, 2008

As days before i posted about AsWing Flash Player 10 compatibility, approved
i saw that the new FP class Vector is not top class yet in Flex SDK 4, but today, fudo posted a issue at aswing forum, i notice that in Flash CS4, it is already a top class.

So i did the renaming, the new name is org.aswing.util.ArrayList, please update from svn if you want to get this change. If you just want swc file, you can download it here http://svn.aswing.org/aswing/trunk/AsWing/swc/AsWing.swc.

How to make a Popup always on top?

November 6th, 2008

Some guys asked me about this question for times, help i thought i should make a post here since you want to know this too.:)

Well, all the Popups in AsWing, including JPopup and all its sub classes such as JWindow JFrame, has their owner — the first param of their constructor, for example new JFrame(owner, …), the owner specified where the popups create their assets. You can set a default owner for all popups by calling AsWingManager.init(defaultOwner, …) or AsWingManager.setRoot(defaultOwner), if there’s a default owner set, you can pass null to the popup constructors, null means to use default one.

So, how to make a popup on top of others? Yes, you already know, just make its owner on top of others, for example, there’s two sprite on your stage, sprite2 is on top of sprite1, if you call AsWingManager.setRoot(sprite1) to make sprite1 as default owner, then you created a popup with sprite2 as its owner for example topFrame = new JFrame(sprite2, …), then you’ll got topFrame always on top of other popups which created with default owner.

BTW, the owner can be a JPopup instance too, if a owner is a popup, the created popup will be its sub popup, always on top of parent popup and if parent popup hide or minimized the sub popup will be non-visible.

Here’s a demo:

public class TopPopup extends Sprite{

private var sprite1:Sprite;
private var sprite2:Sprite;

public function TopPopup(){
super();
sprite1 = new Sprite();
sprite2 = new Sprite();
addChild(sprite1);
addChild(sprite2);

AsWingManager.initAsStandard(sprite1);
createFrame(null, "Normal Frame1");
createFrame(null, "Normal Frame2");
createFrame(createFrame(null, "Parent"), "Sub").setSizeWH(100, 80);
createFrame(sprite2, "Top Frame").setSizeWH(200, 140);
}

private function createFrame(owner:*, title:String):JFrame{
var frame:JFrame = new JFrame(owner, title);
frame.setDragDirectly(true);
frame.setSizeWH(140, 100);
frame.setLocationXY(Math.random()*200, Math.random()*100);
frame.show();
return frame;
}

}

TopPopup
(Click here to run the SWF)

  • A3 , Tutorials
  • Comments Off on How to make a Popup always on top?

Create a AsWing’s NumericStepper

November 5th, 2008

Although we have JAdjuster component for AsWing, steroids but sometimes people ask us for NumericStepper, viagra here most time, we tell them just use JAdjuster, we know it’s different, but most time they are replacable.

Well, if you do want a NumericStepper component, it’s easy to create by your self, just combine with JTextField+2Button, with a BoundedRangeModel, a basic MVC NumericStepper component born.

Here’s a example implementation, see the demo screenshot below:
NumericStepper

The test App source code:

package{

import flash.display.Sprite;
import flash.events.Event;

import org.aswing.*;

public class NumericStepperTest extends Sprite{

private var infoText:JTextArea;
private var ns:NumericStepper;

public function NumericStepperTest(){
super();
AsWingManager.initAsStandard(this);
var frame:JFrame = new JFrame(null, "NumericStepperTest");
var topPane:JPanel = new JPanel();
ns = new NumericStepper();
var button:JButton = new JButton("Reset");
topPane.appendAll(button, ns);

infoText = new JTextArea();
frame.getContentPane().append(topPane, BorderLayout.NORTH);
frame.getContentPane().append(
new JScrollPane(infoText), BorderLayout.CENTER);
frame.setSizeWH(300, 300);
frame.show();

ns.addStateListener(__nsStateChanged);
button.addActionListener(__resetValue);
}

private function __resetValue(e:Event):void{
ns.getModel().setValue(50);
}

private function __nsStateChanged(e:Event):void{
infoText.appendByReplace("value : " + ns.getModel().getValue()+"
");
infoText.scrollToBottomLeft();
}
}
}

Well, for copyright reason, i can’t post all of the component codes, maybe after the book published, there will be a downloadable version.

But trust me, if you want, you can implement it easily by yourself, a Container with a BorderLayout, left is a JTextField(lost border and background), right is a Box contains two JButton with Arrow Icons, and with a BoundedRangeModel to hold the data(you can take JAdjuster as example), finally create a Border to your NumericStepper, it is!

  • A3 , Tutorials
  • Comments Off on Create a AsWing’s NumericStepper

AsWing Flash Player 10 compatibility

November 3rd, 2008

Some days ago, angina Stef and Oliver told about the flash player 10 new class Vector conflict with AsWing’s org.aswing.util.Vector, seems we need to rename AsWing one to another name. Some like ASVector(since we have ASFont, ASColor etc.) or just ArrayList.

But today i finally got a chance to try Flex4 SDK, i compiled a SWF with AsWing component and FP10 Vector, in fact it is __AS3__.vec.Vector, not a top class. There’s not any problem, every thing runs very well.

So, i guess, maybe after Flex 4 SDK formal version released, Vector will become a top class?
Then, there will not have problem too, just, if you use two Vector class in same class file, you have to always use the full name of org.aswing.util.Vector, it’s not really a problem, just, hmmm, not convenient.

I can’t just rename the class name right now before more full test, but i guess i will finally rename our Vector to ArrayList, and maybe replace most our Vector use to Adobe’s, since it is much faster?

Except this, i have not found any other compatibility problem of AsWing on FP10, if you found some, please must tell me!:)

  • A3 , Tutorials
  • Comments Off on AsWing Flash Player 10 compatibility