Scrap focusRectSkin :) You can just add a border Sprite to the UILoader
and toggle its alpha on mouse up/down.
A quick example:
public class Main extends Sprite {
public function Main():void {
var ldr:UILoader = new UILoader();
with(ldr){
buttonMode = true;
mouseChildren = false;
}
ldr.addEventListener(MouseEvent.MOUSE_DOWN, onLdrMouseDown);
ldr.addEventListener(MouseEvent.MOUSE_UP, onLdrMouseUp);
ldr.load(new URLRequest("sky.jpg"));
var ldrBdr:Sprite = new Sprite();
with(ldrBdr){
name = "border"
alpha = 0;
}
with(ldrBdr.graphics){
lineStyle(1, 0xff0000);
drawRect(0, 0, ldr.width, ldr.height);
}
ldr.addChild(ldrBdr);
addChild(ldr);
}
private function onLdrMouseDown(e:MouseEvent):void {
e.target.getChildByName("border").alpha = 1;
}
private function onLdrMouseUp(e:MouseEvent):void {
e.target.getChildByName("border").alpha = 0;
}
}
Kenneth Kawamoto
http://www.materiaprima.co.uk/
anuj sharma wrote:
Hi Kenneth
Thanks for reply. When i am trying to use ocusRectSkin it is giving me
error.
Can yo please provide some sample code which helps me to implement it.
Appreciate ur help
Anuj
On Fri, Feb 29, 2008 at 2:33 AM, Kenneth Kawamoto
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
Can you set the focusRectSkin style?
--
Kenneth Kawamoto
http://www.materiaprima.co.uk/
anuj sharma wrote:
> Hi
> Does anyone now how to change the border color of the UILoader
component
> when user clicks on that. I have put UILoader in the sprite
container and i
> need to implement that if user selects that UILoader its border
color will
> be changed (to red may be).
> Please help me out . Here's the my dummy code for that. Basically
what I
> need is the border of UILoader to be shown as soon as mousedown
event is
> generated and the border to hide as soon as mouseup event is
generated.
> Any help or any new idea will be highly appreciated.
> Thanks
> Anuj
>
> /****************CODE******************
> var container:Sprite=new Sprite();
> var myUILoader:UILoader = new UILoader();
> myUILoader.source = "XYZ.swf";
> myUILoader.load();
> container.addChild(myUILoader);
> addChild(container);
>
> myUILoader.addEventListener(MouseEvent.MOUSE_DOWN,dragUILoader);
> myUILoader.addEventListener(MouseEvent.MOUSE_UP,dropUILoader);
> myUILoader.addEventListener(MouseEvent.CLICK,
moveSelectedVideoOnFront);
>
> function moveSelectedVideoOnFront(event:MouseEvent):void
> {
> //Brings selected UILoader on top
> }
> function dragUILoader(e:MouseEvent):void
> {
> //Allows dragging of the UILoader
> }
> function dropUILoader(e:MouseEvent):void
> {
> //Allows dropping of the UILoader
> }
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders