[Flashcoders] TextField TabIndex in flex

2009-07-24 Thread Sumeet Kumar

Hi All,

I am adding  two textfields dynamically using the code written below and 
after that i am trying to set the tabindex for the two textfields. But i am 
not able to set the tabIndex for the textfields added dynamically. Can 
anyone please guide what am i doing wrong here? Here is the code for the 
same



mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute
mx:Script
 ![CDATA[
  import mx.managers.FocusManager;
  import mx.core.UIComponent;
  import mx.core.UITextField;

  function fnDrawTextField(){
 var mytxt:TextField = new TextField ();
 var ut:UIComponent = new UIComponent()
 mytxt.width = 300
 mytxt.height = 40
 mytxt.text = Called the function;
 mytxt.x = 100;
 mytxt.y = 100;
 mytxt.type = TextFieldType.INPUT
 mytxt.border = true
 mytxt.tabEnabled =true;
 mytxt.tabIndex =1;
 ut.addChild(mytxt)
 this.addChild(ut)
 }

  function fnDrawTextFieldSecond(){
   var mytxt:TextField = new TextField()
   var ut:UIComponent = new UIComponent()
   mytxt.width = 300
   mytxt.height = 40
   mytxt.text = Called the function;
   mytxt.x = 500;
   mytxt.y = 500;
   mytxt.type = TextFieldType.INPUT
   mytxt.border = true
   mytxt.tabEnabled = true
   mytxt.tabIndex =2;
   ut.addChild(mytxt)
   this.addChild(ut)
  }
 ]]
/mx:Script
mx:Button x=333 y=309 click=fnDrawTextField();

/mx:Button
mx:Button x=578 y=309  click=fnDrawTextFieldSecond();

/mx:Button
/mx:Application

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Package problem in Flex

2009-07-24 Thread Cheetham, Marcus
 
I'm importing an AS3 class into my Flex app. It imports fine and the
trace message in the constructor works ok.
However, when I try to create additional functions (Hello)  I get the
message :

1114: The public attribute can only be used inside a package.

This is despite the fact that I have created a package. Any idea what
I'm doing wrong? Here's the class code:

-
package com.pearson.utils
{
public class PlaceItemsInSeries
{

public function PlaceItemsInSeries()
{

trace(Place Items in Series Class);

public function Hello():void
{
trace(Hello);
}
}
}
}
-

In the Flex module I'm importing the class using this code:

import com.pearson.utils.PlaceItemsInSeries;

I'm calling the function later on using this code:
PlaceItemsInSeries.Hello();

It doesn't work due to the package error

 
This email was sent by a company owned by Pearson plc, registered office at 80 
Strand, London WC2R 0RL.
Registered in England and Wales with company number 53723

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] RE: Package problem in Flex

2009-07-24 Thread Cheetham, Marcus

 Ignore this message. I've just seen the error of my ways. I shouldn't
be nesting the function inside the constructor function. Knew it must be
something obvious.

-Original Message-
From: Cheetham, Marcus 
Sent: 24 July 2009 11:17
To: 'Flash Coders List'
Subject: Package problem in Flex

 
I'm importing an AS3 class into my Flex app. It imports fine and the
trace message in the constructor works ok.
However, when I try to create additional functions (Hello)  I get the
message :

1114: The public attribute can only be used inside a package.

This is despite the fact that I have created a package. Any idea what
I'm doing wrong? Here's the class code:

-
package com.pearson.utils
{
public class PlaceItemsInSeries
{

public function PlaceItemsInSeries()
{

trace(Place Items in Series Class);

public function Hello():void
{
trace(Hello);
}
}
}
}
-

In the Flex module I'm importing the class using this code:

import com.pearson.utils.PlaceItemsInSeries;

I'm calling the function later on using this code:
PlaceItemsInSeries.Hello();

It doesn't work due to the package error

 
This email was sent by a company owned by Pearson plc, registered office at 80 
Strand, London WC2R 0RL.
Registered in England and Wales with company number 53723

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Package problem in Flex

2009-07-24 Thread Cedric Muller

Hello,

this should work:


package com.pearson.utils
{
public class PlaceItemsInSeries
{

public function PlaceItemsInSeries()
{
trace(Place Items in Series Class);
}

public function hello():void
{
trace(Hello);
}
}
}

You placed your 'Hello' function in the constructor ... it must be  
sitting on the same level than the constructor, not inside.


Moreover, it is best to name function with a lower cap: 'Hello'  
becomes 'hello' as it is only a public method of the  
PlaceItemsInSeries class.



Take care,
Cedric


package com.pearson.utils
{
public class PlaceItemsInSeries
{

public function PlaceItemsInSeries()
{

trace(Place Items in Series Class);

public function Hello():void
{
trace(Hello);
}
}
}
}


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] papervision as2 mouse projection

2009-07-24 Thread Hans Wichman
Hi list,

I need to find the coordinates of a mouseclick within a plane in
actionscript 2 papervision and I can't figure out how to do it.
Has anyone got any pointers for me, my 3d math skills are vry rusty?

regards,
JC
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] papervision as2 mouse projection

2009-07-24 Thread Glen Pike

Hi,

   I thought that PaperVision provided that information for you - check 
the docs...


   Glen

Hans Wichman wrote:

Hi list,

I need to find the coordinates of a mouseclick within a plane in
actionscript 2 papervision and I can't figure out how to do it.
Has anyone got any pointers for me, my 3d math skills are vry rusty?

regards,
JC
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] papervision as2 mouse projection

2009-07-24 Thread Hans Wichman
Hi,

yes the as3 version does:)
But I'm very lucky to be stuck on the same as2 project for 5 years in a
row...

However I chose the easy way out, I've drawn the hotspot in a separate layer
and now I can click.
Not sure how this is going to add up performance wise, but time will tell!

tnx
JC

On Fri, Jul 24, 2009 at 2:35 PM, Glen Pike g...@engineeredarts.co.ukwrote:

 Hi,

   I thought that PaperVision provided that information for you - check the
 docs...

   Glen

 Hans Wichman wrote:

  Hi list,

 I need to find the coordinates of a mouseclick within a plane in
 actionscript 2 papervision and I can't figure out how to do it.
 Has anyone got any pointers for me, my 3d math skills are vry rusty?

 regards,
 JC
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] problem with a 2 level menu

2009-07-24 Thread Isaac Alves
Hello ! I'm trying to build a 2 level menu, and its submenus are quite big,
they contain a lot of sub-items.

I'm trying to find a simple way to do it (actually I just want that it work)
, but I'm having lots of problems.

As you will be able to see in the code below, I'm placing the dynamically
created subMenu mc inside the menuItem mc.

Each aba mc should get their width and height according to the w and h of
the subMenu it contains.

i've erased the biggest part of the code so I can concentrate in this
problem.

you can see it here: http://iialves.com/apres/
here is the code:

var xmlPath:String = menu.xml;
var myXMLLoader:URLLoader = new URLLoader();
var menuItems:XMLList;
var totalMenuItems:int;

var menu_mc:MovieClip = new MovieClip();
var square:MovieClip;
var menuArray:Array = new Array;
//var subMenuArray:Array = new Array;

var itemWidth:Number;

// MENU (INDEX)
function processXML (e:Event):void{
var myXML:XML = new XML(e.target.data);
//myXML.ignoreWhitespace = true;
menuItems = myXML.children(); //substitui myXML.IMAGE; parece fazer a
mesma coisa
totalMenuItems = menuItems.length();
myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
myXMLLoader = null;
iniciarMenu();
}

function iniciarMenu ():void{
for (var i:Number = 0; i  totalMenuItems; i++){

var menuItem:MenuItem = new MenuItem();
menuItem.bt_title._txt.autoSize =  TextFieldAutoSize.LEFT;
menuItem.bt_title._txt.text = menuitems[...@label;
menuItem.bt_title._txt.antiAliasType = AntiAliasType.ADVANCED;

itemWidth = stage.stageWidth/totalMenuItems;
menuItem.menufill.width = itemWidth;

menuItem.x = i*(stage.stageWidth/totalMenuItems);

menuItem.mouseChildren = true;
menuItem.bt_title.mouseEnabled = false;
menuItem.bt_title.mouseChildren = false;
menuItem.menufill.mouseEnabled = false;
menuItem.aba.mouseEnabled = false;

menuItem.indice = i;

var subMenu:MovieClip = new MovieClip();
subMenu.name = sub_menu;  // Is there something wrong with this?
subMenu.alpha = 0;
subMenu.visible = false;
subMenu.mouseChildren = false;
//subMenu.mouseEnabled = false;

menuItem.addChild(subMenu);

menuArray[i] = menuItem;
menu_mc.addChild(menuItem);

createSubMenu(i);

menuItem.aba.alpha = 0;
menuItem.aba.width = subMenu.width;
menuItem.aba.height = 45 + subMenu.height;


//subMenu.addEventListener(MouseEvent.MOUSE_OVER, mouseOverSub);
}

menu_mc.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
menu_mc.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
menu_mc.addEventListener(MouseEvent.CLICK, itemClicked);

//stage.dispatchEvent(new Event(Event.RESIZE));
}

function createSubMenu(i:int):void{
var subItems:XMLList = menuItems[i].children();

var rows:int = 11;
var yCounter:Number = 0;
var xCounter:Number = 0;

for (var j:Number = 0; j  subItems.length(); j++){

var subMenuItem:SubMenuItem = new SubMenuItem();
subMenuItem.bt_title._txt.autoSize =  TextFieldAutoSize.LEFT;
subMenuItem.bt_title._txt.text = subItems[j];

if (subitems[...@level == 1){
subMenuItem.bt_title._txt.textColor = 0xCC;
}
if (subitems[...@level == 2){
subMenuItem.bt_title._txt.textColor = 0xD0F858;
}
if (subitems[...@level == 3){
subMenuItem.bt_title._txt.x += 10;
}

subMenuItem.bt_title._txt.antiAliasType = AntiAliasType.ADVANCED;

subMenuItem.y = 45 + yCounter*(subMenuItem.height);
subMenuItem.x = xCounter*subMenuItem.width;

//subMenuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverSub);

if (yCounter  rows){
yCounter = 0;
xCounter ++;
} else{
yCounter ++;
}

subMenuItem.mouseChildren = false;
//subMenuItem.mouseEnabled = false;

// getChildAt(3) refers to the the movieclip sub_menu
// because menuArray[i].sub_menu returns undefined. why?
menuArray[i].getChildAt(3).addChild(subMenuItem);

}
//subMenu.addEventListener(MouseEvent.MOUSE_OVER, mouseOverSub);
}

function mouseOverSub(e:MouseEvent):void {
trace ( MOUSE OVER SUBMENU ITEM FINALLY WORKS );
}

function mouseOverItem(e:Event):void {
var item:MenuItem = e.target as MenuItem;

trace (ch2.name:  + item.getChildAt(2).name); //returns bt_title
trace (item.bt_title); //returns [object MovieClip]  great.
trace (ch3.name:  + item.getChildAt(3).name); //returns sub_menu
trace (item.sub_menu); //returns undefined   WHY

item.aba.visible = true;
item.aba.alpha = 1;
item.getChildAt(3).visible = true;
item.getChildAt(3).alpha = 1;
}

function mouseOutItem(e:Event):void {
var item:MenuItem = e.target as MenuItem;

item.aba.visible = false;

[Flashcoders] Re: Flashcoders Digest, Vol 22, Issue 26

2009-07-24 Thread Isaac Alves
Actually this is no lockroot problem, like I thought it was for a moment.
A friend told me it might be that but after a little thinking its clear that
it isn´t . cause  this gets the same movieclip.  it is then really weird
for me why does it returns different number of children 
 ok
i´ve solved the problem.

this function was called by the top.swf timeline as:  infoBox.intro();

when running top.swf ok. but when running preloader.swf  that will load
top.swf, it didn´t work.

What is the problem in calling a function (from main time line of swf Y)
that is in a movieclipZ ( that´s inside the maintime line of Y), and then
have a swf X loading the swf Y??

Thanks!


 Hi fellows, I´m having a weird problem here:

 This code is inside the movieclip Info_1, which is a child of the stage
 in
 top.swf.

 function intro():void{
trace (this:  + this);
trace (thischldren:  + this.numChildren);
trace (child 0:  + this.getChildAt(0));
trace (child 0name:  + this.getChildAt(0).name);
 (...)

 and i-m using is a preloader.swf that loads top.swf.
 when running  top.swf it traces:

 this: [object Info_1]
 thischldren: 9
 child 0: [object MovieClip]
 child 0name: faixa
 12988

 when running  preloader.swf it traces:

 this: [object Info_1]
 thischldren: 1
 child 0: [object Shape]
 child 0name: instance6
 18669

 as you can see, the object faixa as well as many others are unacessible
 when I execute preloader.swf.
 any clue why that happens ??
 thanks !!
 isaac


 --

 Message: 4
 Date: Thu, 23 Jul 2009 15:17:45 -0300
 From: Isaac Alves isaacal...@gmail.com
 Subject: [Flashcoders] accessing movieclips, problem using preloader
 To: flashcoders@chattyfig.figleaf.com
 Message-ID:
9719fa510907231117p5865f79ay15f24b66b0a53...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1

 it worked with MovieClip(parent).

 im looking now for something like lockRoot   for as3
 any clue how could I handle this?

 thanks!
 isaac


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] AS3: for in loops with nested MCs

2009-07-24 Thread Schnurgle Schnurgle
I'm migrating an AS2 project to AS3. I'm not sure how to approach this part of 
the migration. I have a  MovieClip called us_states_mc. It contains 50 
MovieClips, one of each US state.  us_states_mc  has this code inside it:

for (var item in this)
{
this[item].id = item.toString();
this[item].onRelease = function ()
{
_root.zoomToState(this.id);
};
};

How can I recreate this functionality in AS3?


  
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for in loops with nested MCs

2009-07-24 Thread ekameleon
Hello :)

Read the reference AS3 of the MovieClip class :

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html

The new display list implementation of the DisplayObjects is different in
AS3.

The MovieClip class inherit the DisplayObjectContainer class and you can use
now :

- the numChildren property to defines the number of childs in the MovieClip
- the getChildAt() method to keep all childs with a specific position

Example :

var action:Function = function( e:Event ):void
{
  trace( e ) ;
}

var item:DisplayObject ;
var size:int = zoomState.numChildren ;
for( var i:int = 0 ; isize ; i++ )
{
 item = zoomState.getChildAt( i ) ;
 item.addEventListener( Event.CLICK , action ) ;
}

If you want learn the AS3, read the documentation :-)

EKA+ :)

2009/7/24 Schnurgle Schnurgle schnur...@yahoo.com

 I'm migrating an AS2 project to AS3. I'm not sure how to approach this part
 of the migration. I have a  MovieClip called us_states_mc. It contains 50
 MovieClips, one of each US state.  us_states_mc  has this code inside it:

 for (var item in this)
 {
this[item].id = item.toString();
this[item].onRelease = function ()
{
_root.zoomToState(this.id);
};
 };

 How can I recreate this functionality in AS3?



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for in loops with nested MCs

2009-07-24 Thread Deepak Sahu
register the click listener to top MC and make it capture phase
true.. and keep checking the event.currentTarget.
hope this help.

On Fri, Jul 24, 2009 at 12:22 PM, Schnurgle Schnurgle
schnur...@yahoo.comwrote:

 I'm migrating an AS2 project to AS3. I'm not sure how to approach this part
 of the migration. I have a  MovieClip called us_states_mc. It contains 50
 MovieClips, one of each US state.  us_states_mc  has this code inside it:

 for (var item in this)
 {
this[item].id = item.toString();
this[item].onRelease = function ()
{
_root.zoomToState(this.id);
};
 };

 How can I recreate this functionality in AS3?



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] TextField TabIndex in flex

2009-07-24 Thread Jer Brand
I think many on the list would say This isn't Flex Coders but the answer
to this one is fairly simple:

Is there a reason you're not using InputText Class rather than wrapping a
TextField in a UIComponent. I'm fairly sure neither TextField nor
UIComponent implement IFocusManagerComonent nor IFocusManagerContainer, so
both are ignored in the Flex tab order.


Rebuilding your example to use InputText works as you want it to, although I
manually assign all tab indexes, not just the ones for InputText -- the tab
order can get wonky otherwise.

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute
mx:Script
 ![CDATA[
  import mx.controls.TextInput;

 protected function fnDrawTextField():void
 {
var mytxt:TextInput = new TextInput()
mytxt.width = 300
mytxt.height = 40
mytxt.text = Called the function;
mytxt.x = 100;
mytxt.y = 100;
mytxt.tabEnabled =true;
mytxt.tabIndex = 5;
this.addChild(mytxt)
 }

 protected function fnDrawTextFieldSecond():void
 {
  var mytxt:TextInput = new TextInput()
  mytxt.width = 300
  mytxt.height = 40
  mytxt.text = Called the function;
  mytxt.x = 500;
  mytxt.y = 500;
  mytxt.tabEnabled = true
  mytxt.tabIndex = 4;
  this.addChild(mytxt)
 }
 ]]
/mx:Script
mx:Button x=333 y=309 click=fnDrawTextField(); tabIndex=1 /
mx:Button x=578 y=309  click=fnDrawTextFieldSecond(); tabIndex=2 /
/mx:Application


Jer
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders