Re: [flexcoders] Using an Alert when handling another event?

2009-02-23 Thread Laurent Cozic
You need to use preventDefault() in the confirmTabDelete function and then 
display the Alert box. Then when the user clicks ok, close the tab 
programmatically. I'm not familiar with SuperTabNavigator but normally this 
kind of events are only dispatched as a result of a user action, so when you 
close the tab programmatically the second time, this will really close it 
without going through the event handler.



private function confirmTabDelete( event:SuperTabEv ent):void {

   Alert.show( Are you sure you want to delete this tab?, Confirm 

delete, Alert.YES | Alert.NO, this, alertListener, null, Alert.NO);

event.preventDefault(); // Prevent default here

}



private function alertListener( eventObj: CloseEvent) :void {

   if (eventObj.detail= =Alert.NO) {
closeTab(); // Really close the tab here

   }

}

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Sat, 2/21/09, lanekelly5 lkel...@gmail.com wrote:
From: lanekelly5 lkel...@gmail.com
Subject: [flexcoders] Using an Alert when handling another event?
To: flexcoders@yahoogroups.com
Date: Saturday, February 21, 2009, 10:18 PM












I'm using a SuperTabNavigator control from the flexlib package.  
When 

the user clicks on the close button for a tab it fires the tabClose 

event.  I have specified a handler for this in the mxml for the 

SuperTabNavigator component:



tabClose=confirmTa bDelete(event) ;



In the confirmTabDelete function I would like to pop up an Alert with 

YES | NO buttons.  According to the SuperTabNavigator docs I can 

cancel the delete action by calling event.preventDefaul t() within the 

confirmTabDelete function.  My problem is that the Alert box uses its 

own handler function for the YES/NO button clicks.  I'm not sure how 

that handler function can reference the event object to call 

preventDefault( ).



private function confirmTabDelete( event:SuperTabEv ent):void {

   Alert.show( Are you sure you want to delete this tab?, Confirm 

delete, Alert.YES | Alert.NO, this, alertListener, null, Alert.NO);



}



private function alertListener( eventObj: CloseEvent) :void {

   if (eventObj.detail= =Alert.NO) {

   //Now what?  How to call preventDefault( ) on the event object 

in confirmTabDelete?

   }

}



Is the secret in the this which is being used as the parent for the 

Alert?  



Any help would be great.



}




 

  




 

















  

Re: [flexcoders] Drawing on skinned component

2009-02-20 Thread Laurent Cozic
 I have tried using a Sprite as the topmost child and drawing on it

I think that's the way to do it. To make sure that your  sprite is always on 
top, just add addChild(yourSprite) at the end of the updateDisplayList 
function. If the sprite is not on the display list, it's going to be added to 
it, and if it's already there, it's going to be pushed on top of all the other 
sprites.

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Fri, 2/20/09, civilu007 civilu.gro...@gmail.com wrote:
From: civilu007 civilu.gro...@gmail.com
Subject: [flexcoders] Drawing on skinned component
To: flexcoders@yahoogroups.com
Date: Friday, February 20, 2009, 8:53 AM












Hello,



I'm trying to draw something on a component skinned using a Flash

skin, but nothing is drawn (or better said, I don't see anything

because the drawing is done beneath the skin).



My code looks something like



public class TestButton extends Button

{

  public function TestButton()

  {

super();

  }



override protected function updateDisplayList( w:Number, h:Number):void

  {

super.updateDisplay List(w, h);



var g:Graphics = graphics;



g.moveTo(0, unscaledHeight / 2);

g.lineStyle( 1, 0x00);

g.lineTo(unscaledWi dth, unscaledHeight / 2);

  }

}



I have tried using a Sprite as the topmost child and drawing on it,

but apparently there's always something above my Sprite and I still

can't see what I draw.



I've googled and searched the group archives for a similar problem,

but either I'm not using the right search terms or nobody had such a

problem before because I can't seem to find anything of help.



So, does anybody have some pointers as to what might one do to draw on

such a component?



Thank you!




 

  




 

















  

Re: [flexcoders] Pointers like in C

2009-02-20 Thread Laurent Cozic
No, there's no pointers. All the objects are passed to functions by reference, 
except for the basic types (Number, String, etc.) which are passed by value.

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Fri, 2/20/09, christophe_jacquelin christophe_jacque...@yahoo.fr wrote:
From: christophe_jacquelin christophe_jacque...@yahoo.fr
Subject: [flexcoders] Pointers like in C
To: flexcoders@yahoogroups.com
Date: Friday, February 20, 2009, 4:07 PM












Hello, 



Did the type Pointer exist in Flex/ActionScript like in C.

int *ptr;



Thank you,

Christophe, 




 

  




 

















  

Re: [flexcoders] Re: Flex server language

2009-02-20 Thread Laurent Cozic
Although I prefer open source software, it's true that most of the time it's 
harder to use an open source version that a paid for equivalent. Coldfusion 
is easier to setup than PHP, Photoshop or Word are more user friendly than Gimp 
or OpenOffice and so on.

Open source software is free but you're kind of expected to make more efforts 
to use it - i.e. read the doc, search Google. Once you are used to it though, 
it's just as good as the paid equivalents.

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Fri, 2/20/09, Jeffry Houser j...@farcryfly.com wrote:
From: Jeffry Houser j...@farcryfly.com
Subject: Re: [flexcoders] Re: Flex server language
To: flexcoders@yahoogroups.com
Date: Friday, February 20, 2009, 4:29 PM


















  It's easy to get things done / setup if you already know what you're
doing.  But, lets compare apples to apples here.



 It seems logical to me that someone wanting to install CF would start
at Adobe.com , and from there could easily find and download the
installers.  

 I chose, Products ColdFusion, and download Free Trial.  Login and I
can either download the developer edition or the trial edition; with
various options for language and/or OS.  



 The CF install process is relatively painless across operating systems
and across web servers.  I have no doubt Adobe (Macromedia / Allaire)
has devoted time to making that easy over the years.



 I doubt the download / install can be done in 10 minutes, but it is a
relatively painless process.  



 On the other hand, if I go to PHP.com (oops, I mean PHP.net ) I click
the download link in the nav bar it gives me 6 options for Windows
Binaries, I have 6 options of 5.2.8 for Windows.  I have no idea which
one is the I need; but none of them are labeled WAMP installer.  



 What would make me, as a PHP newbie, go looking for an installer from
a 3rd party?  What if I don't want to install Apache or MySQL?  





Amy wrote:

  --- In flexcod...@yahoogro ups.com, Jeffry Houser j...@... wrote:
  
  
 I prefer CF because it is what I know.  Since it comes from Adobe 

  
  it's 
  
  
integration w/ Flex is top notch. 

 After 2 days of trying, I gave up trying to get PHP to work on my 

  
  dev 
  
  
machine; so I'm amused by the claim it can be setup w/ minimal fuss. 

  
  I wonder how 10 minutes to find and install WAMP stacks up against the 
time to order Coldfusion, get it, and install it...?


  





-- 
Jeffry Houser, Technical Entrepreneur
Adobe Community Expert: http://tinyurl. com/684b5h
http://www.twitter. com/reboog711  | Phone: 203-379-0773
--
Easy to use Interface Components for Flex Developers
http://www.flextras .com?c=104
--
http://www.theflexs how.com
http://www.jeffryho user.com
--
Part of the DotComIt Brain Trust



 

  




 

















  

Re: [flexcoders] Reading an UTF-8 document

2009-02-19 Thread Laurent Cozic
Can't you just skip the first three characters and read from there? Otherwise, 
you could try removing the BOM before loading the stream (maybe by reading it 
first as a ByteArray?). I think there's some ActionScript code on this page to 
do that: 

http://www.xs4all.nl/~mechiel/projects/bomstrip/

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Wed, 2/18/09, Andrew roly...@gmail.com wrote:
From: Andrew roly...@gmail.com
Subject: [flexcoders] Reading an UTF-8 document
To: flexcoders@yahoogroups.com
Date: Wednesday, February 18, 2009, 10:19 PM












Please forgive me if the is a post about this already but i can't 
seem

to find it.



I am creating an AIR app to convert characters into their HTML entity,

hex and dec value and I have just come across an issue.  I am reading

in xml files which contain the data, these files are saved in a UTF-8

format.



When I open it using a Filestream it stops after the first 3

characters ÿþ.  I know that these characters are the start of a

unicode document, but I can't figure out why it is stopping reading

the file there.



Any help would be greatly appreciated.




 

  




 

















  

Re: [flexcoders] Re: Drawing graphics on an image

2009-02-19 Thread Laurent Cozic
You can't draw directly on an mx:Image component. As suggested below, you need 
to add a Sprite on top of the image and draw on that sprite. The best way would 
probably be to inherit from mx:Image and do the drawing in updateDisplayList(). 
For example:

?xml version=1.0 encoding=utf-8?
mx:Image xmlns:mx=http://www.adobe.com/2006/mxml;
    
    mx:Script
        ![CDATA[
        
            private var yourSprite:Sprite;            
            
            override protected function createChildren():void {
                super.createChildren();                    
                if (!yourSprite) yourSprite = new Sprite();
            }            
            
            override protected function updateDisplayList(unscaledWidth:Number, 
unscaledHeight:Number):void {
                super.updateDisplayList(unscaledWidth, unscaledHeight);
                
                // Do the drawing on yourSprite.graphics here
                
                addChild(yourSprite);
            }            
            
        ]]
    /mx:Script
    
/mx:Image


Also, if you need to clear the image, just set Image.source to null.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Thu, 2/19/09, christophe_jacquelin christophe_jacque...@yahoo.fr wrote:
From: christophe_jacquelin christophe_jacque...@yahoo.fr
Subject: [flexcoders] Re: Drawing graphics on an image
To: flexcoders@yahoogroups.com
Date: Thursday, February 19, 2009, 4:53 PM












It is OK for drawing the lines but when I draw a new line I would 
like

to erase the preceeding lines that are on the image. I clear the

sprite but it is not working.



Thank you for your help.

Christophe, 



--- In flexcod...@yahoogro ups.com, jer_ela g...@... wrote:



 The graphics object for the image or the container it is in, is below

 the content so it is hidden behind the image.  Stick a display object

 such as a sprite on top or it and draw on its graphics object.

 

 --- In flexcod...@yahoogro ups.com, christophe_ jacquelin

 christophe_ jacquelin@  wrote:

 

  Hello, 

  

  I want to draw graphics (graphics.lineto) on an existing image, but

  the lines does not appear. Is it possible to make graphics on an

 image ? 

  

  Thank you,

  Christophe,

 






 

  




 

















  

Re: [flexcoders] Read XML files

2009-02-19 Thread Laurent Cozic
Parsing XML is built into AS3, see for example: 
http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm

To load an XML file, see URLLoader and URLRequest. For example:

var loader = new URLLoader();
loader.load(new URLRequest(http://example.com/xml.xml;));
loader.addEventListener(complete, xmlLoaded);

function xmlLoaded(event) {
   var xmlString = event.currentTarget.data;

   // and parse the XML here
}

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Thu, 2/19/09, christophe_jacquelin christophe_jacque...@yahoo.fr wrote:
From: christophe_jacquelin christophe_jacque...@yahoo.fr
Subject: [flexcoders] Read XML files
To: flexcoders@yahoogroups.com
Date: Thursday, February 19, 2009, 5:04 PM












Hello,



Which instructions to use to read/write XML files ?



Thank you,

Christophe,




 

  




 

















  

Re: [flexcoders] Country List

2009-02-18 Thread Laurent Cozic
Here: http://www.google.com/search?q=country+list

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Wed, 2/18/09, christophe_jacquelin christophe_jacque...@yahoo.fr wrote:
From: christophe_jacquelin christophe_jacque...@yahoo.fr
Subject: [flexcoders] Country List
To: flexcoders@yahoogroups.com
Date: Wednesday, February 18, 2009, 8:56 AM












Hello, 



I want to make a combo with the list of country. Where can I find such

a list ?



Thank you,

Christophe,




 

  




 

















  

Re: [flexcoders] Send a confirmation Email

2009-02-18 Thread Laurent Cozic
This would open the user's email client, and I don't think he would want the 
user to send the confirmation email to himself. I think that the right way 
would be to use a server side script that would take the username as a 
parameter, build the email and send it.

You can do that quite easily in PHP:

http://email.about.com/cs/phpemailtips/qt/et031202.htm

Then in Flex, just use URLLoader to call the PHP script.

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Wed, 2/18/09, Simon Bailey si...@newtriks.com wrote:
From: Simon Bailey si...@newtriks.com
Subject: Re: [flexcoders] Send a confirmation Email
To: flexcoders@yahoogroups.com
Date: Wednesday, February 18, 2009, 10:02 AM












A quick and easy way to do this would be to use URLRequest as below:
navigateToURL( new URLRequest( mailto:simon@ newtriks. com?subject= 
Registration Complete ), _blank );
Simon [ Website ] newtriks.com [ Blog ] nutrixinteractive. com/blog/ 

On 18 Feb 2009, at 08:57, christophe_jacqueli n wrote:
Hello,

How to send a confirmation Email in the flex program when the user get
register ? 

Thank you,
Christophe,



 

  




 

















  

Re: [flexcoders] Re: is it possible to track visitors / the page an swf is embedded on

2009-02-18 Thread Laurent Cozic
Application.application.url will give you the url of the *swf file*, not the 
url of the document within which the app is embedded. For that, the only way is 
to use Javascript and ExternalInterface. I think the syntax is:

var docURL = ExternalInterface.call(location.href);

or it might be document.location.href - not sure which one is right.

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Wed, 2/18/09, kuntamayu kuntam...@yahoo.com wrote:
From: kuntamayu kuntam...@yahoo.com
Subject: [flexcoders] Re: is it possible to track visitors / the page an swf is 
embedded on
To: flexcoders@yahoogroups.com
Date: Wednesday, February 18, 2009, 12:31 PM














Try to track



Application. application. url



This may help you. :)



--- In flexcod...@yahoogro ups.com, Tracy Spratt tspr...@...  wrote:



 Look into the BrowserManager, perhaps it will help.

 

  

 

 Tracy Spratt 

 Lariat Services 

 

 Flex development bandwidth available 

 

  _ _ __

 

 From: flexcod...@yahoogro ups.com [mailto:flexcod...@yahoogro ups.com] 

On

 Behalf Of uclamerrick

 Sent: Wednesday, February 18, 2009 12:24 AM

 To: flexcod...@yahoogro ups.com

 Subject: [flexcoders] is it possible to track visitors / the page an 

swf

 is embedded on

 

  

 

 Lets say I run a video site like youtube, how can I capture the url 

of

 the page where my swf object is embedded.

 

 For example someone takes the embed code from

 http://youtube. com/videoid123 http://youtube. com/videoid123  and

 places it onto the page at

 http://myblog. wordpress. com/this_ video_rocks

 http://myblog. wordpress. com/this_ video_rocks 

 

 I know how to use HTTPService to report this information back to my

 server and store it in the database, but I don't know how to use 

Flex

 3 / Actionscript 3 to determine the URL of the page that embeds an

 swf. In the example above I would want to capture:

 

 http://myblog. wordpress. com/this_ video_rocks

 http://myblog. wordpress. com/this_ video_rocks 

 

 Thanks.






 

  




 

















  

Re: [flexcoders] Time stamping a user Logout

2009-02-18 Thread Laurent Cozic
You could make the app ping the server every 5 minutes. Then if the server 
doesn't receive the ping, assume that the user closed the browser and log him 
out.

Another simpler solution would be to put a timeout on the session.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Wed, 2/18/09, grg_blls grg_b...@yahoo.com wrote:
From: grg_blls grg_b...@yahoo.com
Subject: [flexcoders] Time stamping a user Logout
To: flexcoders@yahoogroups.com
Date: Wednesday, February 18, 2009, 1:18 PM












Hi all,



I have concluded a sample Flex application where a user logs in (or 

registers) in the application. 



I use the Tomcat servlet container plus BlazeDS RPC component and 

Hibernate persistence to connect to MySQL database. 



A new user first registers by filling the Registration form. The 

database is updated for First Creation Timestamp, along with user's 

UserName and Password. 



A returning user fills a (similar) Login form. The database is 

updated for Login Timestamp. When the user does a normal Logout, the 

database is updated with Logout Timestamp. On User's Logout the 

User_Loged session time is summed in UserTotalLoged time.



My problem is that I need dispatch/listen (?) an event in an abrupt 

case, like the user instead of doing a normal logout simply closes 

the browser, or the client/server connection is just lost. Then I 

have to update the database that the user status is Logout. 



I hope this description is clear enough for some indications/ help.



Thank you all

George

   




 

  




 

















  

Re: [flexcoders] How to copy each property of object A to B ?

2008-08-22 Thread Laurent Cozic
Have a look at mx.utils.ObjectUtil.copy()

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Fri, 8/22/08, piotrchruscielewski [EMAIL PROTECTED] wrote:
From: piotrchruscielewski [EMAIL PROTECTED]
Subject: [flexcoders] How to copy each property of object A to B ?
To: flexcoders@yahoogroups.com
Date: Friday, August 22, 2008, 8:03 AM











Hi



I`ve got one small question, that I still can`t resolve.



suppose we have class Person , and variables:



var p1:Person;



p1.name = 'John';



not we have some other reference to this object (for.ex. from other 

part of program)



var p2:Person = p1;



If I`ll now make 

p1.name = 'Steve'



of course p2.name will also be Steve - that`s clear.



But now we receive object p3:Person and we wan`t to 'copy' it on p1 

object ( so that p1 will be the same as p3).



If we will make

 p1 = p3 ; 

it will of course create reference and p2 object, and all other 

references to p1 will remain unchanged.



The only way to change p1 DATA not REFERENCE is to do:

p1.name = p3.name 



So now p2.name will be a new one



The question is - how can we copy each property VALUE of one object 

to the other. If Person have a lot of properties - we need to write 

each property.



Maybe we could make some loop like 

 for each attribute in Person 

   p1.['attribute' ] = p3.['attribute' ]



But it`s still not elegant



Is there any way to do:

 memcpy(p3,p1) ?



Regards



Piotr Chruscielewski

   




  




 

















  

Re: [flexcoders] Flex is time consuming

2008-08-18 Thread Laurent Cozic
Open the Task Manager while your are making changes and check if one of the 
processes is taking too much CPU. 

Now and then, I have one of the svchost.exe processes taking 99% CPU each time 
I press a key in Flex. Once I kill the process everything goes back to normal.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Mon, 8/18/08, litesh_b321 [EMAIL PROTECTED] wrote:
From: litesh_b321 [EMAIL PROTECTED]
Subject: [flexcoders] Flex is time consuming
To: flexcoders@yahoogroups.com
Date: Monday, August 18, 2008, 1:30 PM











Hi gyus 

i have around 16000 line of code 

which is already broke up in two mxml file and five class file 

still what ever i want to change in my application flex is taking time 

why so it is happening 

i turn off my auto refresh option ,auto built option 



Plz Help me out 

ThanX




  




 

















  

Re: [flexcoders] Resize from left to right

2008-08-14 Thread Laurent Cozic
I usually do it by first moving the component and then applying the new width 
and height to it. I don't know if Flex has any built in way to do that.


var newWidth = 200;
var newHeight = 200;

button.x = button.x + button.width - newWidth;
button.y = button.y + button.height - newHeight;
button.width = newWidth;
button.height = newHeight;


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Thu, 8/14/08, Rico Leuthold [EMAIL PROTECTED] wrote:
From: Rico Leuthold [EMAIL PROTECTED]
Subject: [flexcoders] Resize from left to right
To: flexcoders@yahoogroups.com
Date: Thursday, August 14, 2008, 8:47 AM











Hi,



I was pretty sure to find the answer in the archive - but nope ...  

couldn't find it.



Is there an easy way to have the resize of a component going from left  

to right ?



Thank's



_rico


  




 

















  

Re: [flexcoders] Mouseevents and nested components

2008-08-14 Thread Laurent Cozic
Hi, you need to stop the event propagation so that it doesn't reach the canvas. 
You do that in your button event handler:


private function traceButton( evt:MouseEvent) :void
{
   evt.stopPropagation();
   trace(trace button  + evt.target + / +
evt.currentTarget) ;
}


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Thu, 8/14/08, Bart Ronsyn [EMAIL PROTECTED] wrote:
From: Bart Ronsyn [EMAIL PROTECTED]
Subject: [flexcoders] Mouseevents and nested components
To: flexcoders@yahoogroups.com
Date: Thursday, August 14, 2008, 2:16 PM















Hi,



A simple question :



I have a simple Flex application, which has a canvas and a button
nested within this canvas.

Both, the canvas and the button have an event handler bound to the
click event.



When I click the button, both the event handlers of the button and the
canvas are called... I expected

only the event handler bound to button to be called, as this is the
deepest nested node..



The Adobe documentation says the following about MouseEvents :

When nested nodes are involved, mouse events target the deepest
possible nested node that is visible in the display list. This node is
called the target node.



http://livedocs. adobe.com/ flex/201/ langref/flash/ events/MouseEven t.html



How can I accomplish only the event handler of the button to be called ?



Thanks for your help !



Bart



Below, a simple test application :



?xml version=1.0
encoding=utf- 8?

mx:Application xmlns:mx=http://www. adobe.com/ 2006/mxml
layout=absolute

mx:Script

    ![CDATA[

        

        private function traceButton( evt:MouseEvent) :void

        {

            trace(trace button  + evt.target + / +
evt.currentTarget) ;

        }

        private function traceCanvas( evt:MouseEvent) :void

        {

            trace(trace canvas  + evt.target + / +
evt.currentTarget) ;

        }

    ]]

/mx:Script

    mx:Canvas backgroundColor= #FF x=136 y=196 width=200
height=200 click=traceCanvas( event)

        mx:Button x=67 y=46 label=Button
click=traceButton( event) /

    /mx:Canvas

    

/mx:Application






  




 

















  

RE: [flexcoders] Displaying custom items in ComboBox

2008-08-14 Thread Laurent Cozic
The exact order of events is described in Creating and extending Flex 
components of the help file. However, in general you shouldn't expect the 
update handlers to be called in any particular order, since a subclass could 
force a call to updateDisplayList() or measure() without your objects being 
ready. So basically you should always check if an object exists before trying 
to access it.

Also, if I'm not mistaken, createChildren() might be called more than once 
during the life time of a component (I think that's when it's removed from the 
stage and added back), so you also need to check that lineHolder is not null 
before creating it.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Thu, 8/14/08, Regert, Michael [EMAIL PROTECTED] wrote:
From: Regert, Michael [EMAIL PROTECTED]
Subject: RE: [flexcoders] Displaying custom items in ComboBox
To: flexcoders@yahoogroups.com
Date: Thursday, August 14, 2008, 2:49 PM



















I’ve implemented it almost the same way your blog sample did,
tweaking only a bit to add a canvas to the holder rather than a icon
class.  I’ve overridden the functions createChildren, measure, and
updateDisplayList just as you have.  I’m a C/C++ developer new to
Adobe Flex and am trying to grasp everything.  I guess I’m not fully
understanding the call stack on this and the order of methods it calls to
render the dropdown.  Is there a good place to learn this?  I had to
put a check in place inside of updateDisplayList to check for null because the
function was being call initially, even before the combobox was rendered. 
I figure I’m just missing the whole picture which is why I’m not
understanding where the selected label is being set.  Thanks. 

   

package { 

  // Custom Combo
Box 

  import
flash.display. DisplayObject; 

  import
mx.containers. Canvas; 

  import
mx.controls. ComboBox; 

  import
mx.core.IFlexDispla yObject; 

  import
mx.core.UIComponent ; 

   

  public class LineComboBox extends ComboBox { 

    // constructor 

    public function LineComboBox( )
{ 

  super(); 

    } 

     

    // Private
attribute to hold the line canvas 

    private var
lineHolder:UICompon ent; 

     

    override protected function
createChildren( ):void { 

  super.createChildren( ); 

  lineHolder
= new UIComponent( ); 

  addChild(lineHolder ); 

    } 

     

    override protected function measure():void { 

  super.measure(); 

  if (iterator
 iterator.current) { 

// MyLineClass
holds a canvas with the line drawn on it 

    var lt:MyLineClass
= iterator.current as MyLineClass; 

    var
line:IFlexDisplayOb ject = lt.getDisplayObject () as Canvas; 

    while
(lineHolder. numChildren  0) { 

  lineHolder.removeCh ildAt(0); 

    } 

    lineHolder.addChild (DisplayObject( line)); 

    measuredWidth
+= line.measuredWidth; 

    measuredHeight
= Math.max(measuredHe ight, line.measuredHeight + borderMetrics. top +
borderMetrics. bottom); 

  } 

    } 

     

    override protected function
updateDisplayList( unscaledWidth: Number, unscaledHeight: Number):void { 

  super.updateDisplayList( unscaledWidth,
unscaledHeight) ; 

  if (selectedItem)
{ 

    var lt:MyLineClass
= selectedItem as MyLineClass; 

    var
line:IFlexDisplayOb ject = lt.getDisplayObject () as Canvas; 

    while
(lineHolder. numChildren  0) { 

  lineHolder.removeCh ildAt(0); 

    } 

    lineHolder.addChild (DisplayObject( line)); 

    measuredWidth
+= line.measuredWidth; 

        measuredHeight
= Math.max(measuredHe ight, line.measuredHeight + borderMetrics. top +
borderMetrics. bottom); 

  } 

    } 

  } 

} 

   

   

   

   

   

   

   

   

   

   

   

   

   




 
  
  
  
  
  
 
 
  
  
  Michael J. Regert 
  
  
 




   





From: [EMAIL PROTECTED] ups.com
[mailto:flexcoders@ yahoogroups. com] On Behalf Of Alex Harui

Sent: Wednesday, August 13, 2008 7:20 PM

To: [EMAIL PROTECTED] ups.com

Subject: RE: [flexcoders] Displaying custom items in ComboBox 





   









Not sure
how you’ve got it coded now, but you can either hide the textInput or
maybe override selectedLabel 

  









From: [EMAIL PROTECTED] ups.com
[mailto:flexcoders@ yahoogroups. com] On Behalf Of Regert, Michael

Sent: Wednesday, August 13, 2008 2:29 PM

To: [EMAIL PROTECTED] ups.com

Subject: RE

Re: [flexcoders] Re: Loop through all visual components

2008-08-13 Thread Laurent Cozic
Not sure but I think you need to make your login variable (whather that is) 
bindable, so that, when it changes, the showName label is notified:


[Bindable]
private var login:String; // just guessing the declaration. The important part 
is the [Bindable] tag



--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Wed, 8/13/08, itdanny2002 [EMAIL PROTECTED] wrote:
From: itdanny2002 [EMAIL PROTECTED]
Subject: [flexcoders] Re: Loop through all visual components
To: flexcoders@yahoogroups.com
Date: Wednesday, August 13, 2008, 10:58 AM













Still not success. I gave an example.



My user enter something e.g. login name and 

then program display the full name.



private function DoChecking(S: String):String {

 ...

if (TryOnce) then { 

  return Already Tried;

}

else {

  return First Time;

}

}



mx:Label id=ShowName text={DoChecking( login)} /mx:Label



First time is ok but when another button is clicked and change

the variable TryOnce. The label 'ShowName' cannot be refreshed

eventhough I use ShowName.validatedi splaylist( ). I also tried

validatenow( )but not successAny help ?



--- In [EMAIL PROTECTED] ups.com, Laurent Cozic pogopixels@ ... 

wrote:



 Somebody ask a similar question on this list recently. You can loop 

through all the components in your app by using the numChildren 

property and getChildAt method:

 

 function checkAllButtons( container) {

 

 ?for (var i = 0; i  container.numChildr en; i++) {

 ??var c = container.getChildA t(i);

 ??if (c is Container) {

 ???checkAllButtons( c);

 ??} else {

 ???if (c is Button) {

 // Do your changes here

 ???}

 ??}

 ? 

 }

 

 

 Then start the process by passing the application as a parameter:

 

 checkAllButtons( Application. application) ;

 

 

 

 

 --

 Laurent Cozic

 

 Flash, Flex and Web Application development

 http://pogopixels. com

 

 --- On Tue, 8/12/08, itdanny2002 Chow.Danny@ ... wrote:

 From: itdanny2002 Chow.Danny@ ...

 Subject: [flexcoders] Loop through all visual components

 To: [EMAIL PROTECTED] ups.com

 Date: Tuesday, August 12, 2008, 9:19 AM

 

 

 

 

 

 

 

 

 

 

 

 I have created a custom button and used it

 

 throughoutly in my FLEX application. How 

 

 can I change it dynamically by looping through 

 

 all components ? Is there any like children

 

 stuff and then use ValidateDisplayLis t to 

 

 make it refresh ? Actually, it likes changing

 

 the skin dynamically. But I need to check the 

 

 content of button before modification. 

 

 

 

 Having example is great. Thanks in advance.






  




 

















  

Re: [flexcoders] Loop through all visual components

2008-08-12 Thread Laurent Cozic
Somebody ask a similar question on this list recently. You can loop through all 
the components in your app by using the numChildren property and getChildAt 
method:

function checkAllButtons(container) {

  for (var i = 0; i  container.numChildren; i++) {
    var c = container.getChildAt(i);
    if (c is Container) {
  checkAllButtons(c);
    } else {
  if (c is Button) {
    // Do your changes here
  }
    }
   
}


Then start the process by passing the application as a parameter:

checkAllButtons(Application.application);




--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Tue, 8/12/08, itdanny2002 [EMAIL PROTECTED] wrote:
From: itdanny2002 [EMAIL PROTECTED]
Subject: [flexcoders] Loop through all visual components
To: flexcoders@yahoogroups.com
Date: Tuesday, August 12, 2008, 9:19 AM











I have created a custom button and used it

throughoutly in my FLEX application. How 

can I change it dynamically by looping through 

all components ? Is there any like children

stuff and then use ValidateDisplayLis t to 

make it refresh ? Actually, it likes changing

the skin dynamically. But I need to check the 

content of button before modification. 



Having example is great. Thanks in advance.




  




 

















  

Re: [flexcoders] Class file in flex

2008-08-12 Thread Laurent Cozic
You can't include a class within a class, you can only include plain 
ActionScript files. So to fix your issue, you simply need to remove the 
package and class statements from your actionscript file.

You should probably also remove the 
import Inculdes.ClassTesting;. Also it might compile, it 
won't make any sense once you convert the AS file.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Tue, 8/12/08, litesh_b321 [EMAIL PROTECTED] wrote:
From: litesh_b321 [EMAIL PROTECTED]
Subject: [flexcoders] Class file in flex
To: flexcoders@yahoogroups.com
Date: Tuesday, August 12, 2008, 10:59 AM











hi guys,

 I am trying action script class in flex 3.0



I have action script class in Inculdes\ClassTest ing.as directory

which is situated inside src directory. 



See code below :

?xml version=1.0 encoding=utf- 8?

mx:Application xmlns:mx=http://www.adobe. com/2006/ mxml

layout=absolute 

mx:Script

![CDATA[

import Inculdes.ClassTesti ng;

import mx.messaging. AbstractConsumer ;

include Inculdes/ClassTest ing.as;

public function ansT():void

  {

ans.text = tester( frst.text,scnd. text);



  }

]]

/mx:Script 

mx:Button x=52 y=192 label=Button id=b1   click=ansT( )

borderColor= #10DD10 height=26 width=69/ 

mx:Text x=52 y=77 text=12 width=293 id=frst visible=true /

mx:Text x=52 y=103 text=23 width=293 id=scnd visible=true 
/

mx:Text x=52 y=155 text=34 width=293 id=ans visible=true 
/

/mx:Application



Error I am facing 



Severity and DescriptionPathResourceLocation
Creation Time   Id

Packages cannot be nested. [Generated code (use -keep to save): Path:

C:\Documents and Settings\pacific\ My Documents\Flex Builder

3\test\src\Inculdes \ClassTesting. as, Line: 2, Column: 1]  test

Unknown 1218537300687   70656



Please help me out 

ThanX




  




 

















  

Re: [flexcoders] Re: Is It Just Me?

2008-08-12 Thread Laurent Cozic

 




Right, it does have a text box, with the color in Hex notation, so
 
you'd assume that there'd be a real easy way, in ActionScript, to pass

 a hex value to it, but there isn't.

 I find this perplexing.



The way Flex displays the data or let you interact with it doesn't necessarily 
match the way it is stored internally. I think it's true of any framework 
including .NET and Java.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Tue, 8/12/08, Dale Cook [EMAIL PROTECTED] wrote:
From: Dale Cook [EMAIL PROTECTED]
Subject: [flexcoders] Re: Is It Just Me?
To: flexcoders@yahoogroups.com
Date: Tuesday, August 12, 2008, 1:09 AM











Right, it does have a text box, with the color in Hex notation, so

you'd assume that there'd be a real easy way, in ActionScript, to pass

a hex value to it, but there isn't.

I find this perplexing.



--- In [EMAIL PROTECTED] ups.com, Josh McDonald [EMAIL PROTECTED] wrote:



 Well the first case wouldn't help mapping from a text-field, and the

post

 was more about I can't figure our how to parse a number than how

should I

 work with colours?

 

 StyleManager. getColorName is an awful, *awful* name for that API if it

 converts from hex colours to uints :)

 

 But I'd still just use parseInt.

 

 Wait, doesn't the colour picker *have* a textbox you can copy/paste

a hex

 code to and from?

 

 -Josh

 

 On Tue, Aug 12, 2008 at 10:33 AM, Maciek Sakrejda [EMAIL PROTECTED] ..wrote:

 

  Well, in this particular case, you could do

 

  // just use uint directly

  fontColor.selectedC olor = 0xd3d3d3;

 

  // or use StyleManager

  fontColor.selectedC olor = StyleManager. getColorName( #D3D3D3 );

 

  Admittedly, getColorName( ) is rather poorly named, and StyleManager is

  not the most obvious place to look (and the

  looks-like-it- should-be- the-right- thing ColorUtil class is not very

  helpful).

 

  Every framework has some unfortunate design decisions; Flex is really

  quite good once you get the hang of it.

 

  --

  Maciek Sakrejda

  Truviso, Inc.

  http://www.truviso. com

 

  -Original Message-

  From: Dale Cook [EMAIL PROTECTED] ..

  Reply-To: [EMAIL PROTECTED] ups.com

  To: [EMAIL PROTECTED] ups.com

  Subject: [flexcoders] Is It Just Me?

  Date: Mon, 11 Aug 2008 23:59:55 -

 

  OK, so I'm new to Flex but I have a lot of experience with other

  development platforms and languages(.NET, RoR, Javascript, etc.).

 

  I've read a few books and I've just been doing some fairly simple

  stuff to get my feet wet but already I'm starting to get a little

  fustrated with things that should be really easy. Perhaps I'm just

  missing something.

 

  For example, I have a colorpicker object and I want to set the

  selected color programmatically depending on which textinput field a

  user is in. So I suspected that I could do something like

 

  //the name of the color picker is fontColor

  fontColor.selectedC olor = #D3D3D3

 

  and everything would be good - but that doesn't appear to be the case.

  It looks like I have to convert the hex into a uint. OK, that seems

  like a lot more work than it should be but OK, I'll just use the

  DecimalToHex function of the int class... oh, wait there isn't one.

  There isn't a conversion anywhere that I can find to do this without

  writting even more code.

 

  Is it just be or does this seem like a lot of work to do something

  that most other modern languages handle without any additional coding,

  or an I completely missing something?

 

  Dale

 

 

 

 

 

 

 

 

   - - --

 

  --

  Flexcoders Mailing List

  FAQ: http://groups. yahoo.com/ group/flexcoders /files/flexcoder sFAQ.txt

  Search Archives:

  http://www.mail- archive.com/ flexcoders% 40yahoogroups. comYahoo! Groups

  Links

 

 

 

 

 

 

 -- 

 Therefore, send not to know For whom the bell tolls. It tolls for

thee.

 

 :: Josh 'G-Funk' McDonald

 :: 0437 221 380 :: [EMAIL PROTECTED]






  




 

















  

Re: [flexcoders] SSL Https communication between swf and data service / life cycle is failed

2008-08-11 Thread Laurent Cozic
Check the outgoing HTTP calls using Live HTTP headers for Firefox. You 
probably have a redirection from https to http at some point. I remember having 
had a similar issue and it had to be fixed server side (can't remember the fix 
though).


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Mon, 8/11/08, loveewind [EMAIL PROTECTED] wrote:
From: loveewind [EMAIL PROTECTED]
Subject: [flexcoders] SSL Https communication between swf and data service / 
life cycle is failed
To: flexcoders@yahoogroups.com
Date: Monday, August 11, 2008, 9:26 AM











below is the source code of swf:

mx:RemoteObject

id=authenticationR emoteService

destination= authentication- remoteobject

showBusyCursor= true

result=result( event );

fault=fault( event );

 /mx:RemoteObject

public function getUserData( ):void{

authenticationRemot eService. getUserData( );

}

public function result(data: Object):void{

.

}

public function fault(info:Object) :void{

mx.controls. Alert.show( info);

}



when I open https://localhost: 9444/life- flex/Login. swf and click the 

event to call getUserData( ) method, fault method throws the following 

exception:



[INFO]: [RPC Fault faultString= Send failed 

faultCode=Client. Error.MessageSen d 

faultDetail= Channel. Connect.Failed error 

NetConnection. Call.BadVersion: : url: 'http://localhost: 9444/life-

flex/messagebroker/ amf']

at 

mx.rpc::AbstractInv oker/http://www.adobe. com/2006/ flex/mx/internal ::fa

ultHandler()

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\rpc\AbstractI nvoker.as: 195]

at mx.rpc::Responder/ fault()

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\rpc\Responder .as:56]

at mx.rpc::AsyncReques t/fault()

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\rpc\AsyncRequ est.as:110]

at mx.messaging: :ChannelSet/ faultPendingSend s()

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\messaging\ ChannelSet. as:1113

]

at mx.messaging: :ChannelSet/ channelFaultHand ler()

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\messaging\ ChannelSet. as:851]

at flash.events: :EventDispatcher /dispatchEventFu nction()

at flash.events: :EventDispatcher /dispatchEvent( )

at mx.messaging: :Channel/ connectFailed( )

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\messaging\ Channel.as: 928]

at mx.messaging. channels: :PollingChannel/ connectFailed( )

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\messaging\ channels\ PollingCh

annel.as:255]

at mx.messaging. channels: :AMFChannel/ statusHandler( )

[E:\dev\flex_ 201_borneo\ sdk\frameworks\ mx\messaging\ channels\ AMFChanne

l.as:346]



Even though I visit application with https link , SWF still use http 

protocol to call AMF gateway.

Who has any experience on this issue?

Thanks.




  




 

















  

Re: [flexcoders] How to pass value to ComboBox selectedItem?

2008-08-11 Thread Laurent Cozic
You need to go through the dataProvider to change the value of the selected 
item. For example:

comboBox.dataProvider.setItemAt(newItem, comboBox.selectedIndex);


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Mon, 8/11/08, Joshua Jackson [EMAIL PROTECTED] wrote:
From: Joshua Jackson [EMAIL PROTECTED]
Subject: [flexcoders] How to pass value to ComboBox selectedItem?
To: flexcoders@yahoogroups.com
Date: Monday, August 11, 2008, 10:41 AM











Dear all,



I haven't succeed passing object value to ComboBox selectedItem, how

do I do this in Flex? In HTML I pass a record id to the option

value.



Best regards,



-- 

Setting a new landmark.

Blog: http://joshuajava. wordpress. com/

Twitter: http://twitter. com/thejavafreak


  




 

















  

Re: [flexcoders] Checking swfs for malicious code!

2008-08-07 Thread Laurent Cozic
I don't think you need to worry about security for loaded contents. The Flash 
player does that very well already and there's probably no way a Flash file 
could do anything malicious.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



--- On Thu, 8/7/08, superbokbok [EMAIL PROTECTED] wrote:
From: superbokbok [EMAIL PROTECTED]
Subject: [flexcoders] Checking swfs for malicious code!
To: flexcoders@yahoogroups.com
Date: Thursday, August 7, 2008, 8:45 AM











Don't know if this is the right place for this, but thought I'd 
throw

out the question before I dive headlong into building something that

isn't do-able.



Basically, I'm building a video player that would allow flash authors

to create their own video/photo/ game and upload to a server. My app

would then take this and use it within the Main video player as they

please. The concern my client has is that the swf's that are

uploaded(AS3) may contain malicious code that might affect other

users/websites etc... The main video players is built in Flex while

the uploaded vids are done in Flash.



Is there any way, other than decompiling swfs and checking the code,

to determine if the code is in fact malicious from a swf?



cheers

erick




  




 

















  

Re: [flexcoders] Returning value inside a nested functions event?

2008-08-06 Thread Laurent Cozic
By definition an event handler shouldn't return a value, since no object can 
actually retrieve this value. You'll need to use some other way - perhaps you 
could save the result in a private variable inside you class, or have the event 
handler call another method. It depends on what you are trying to do.

 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: Berkay Unal [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Wednesday, August 6, 2008 3:25:53 PM
Subject: [flexcoders] Returning value inside a nested functions event?


Hi Coders

I want to return a value from a handler function that is nested inside a 
function. The scenario is to check the duplicate

Does anybody know how to achieve it?

public function checkDuplicate( email:String) :Boolean {
var checkStmt:SQLStatem ent = new SQLStatement( );
checkStmt.sqlConnec tion = conn;
varsql:String = select * from people where email = '[EMAIL PROTECTED]' ; 
checkStmt.text = sql;
checkStmt.addEventL istener(SQLEvent .RESULT, function(e:SQLEvent) :Boolean {
var result:SQLResult = checkStmt.getResult ();
Alert.show(result. data[0][name])
returntrue;
});
//checkStmt. addEventListener (SQLErrorEvent. ERROR, errorDBHandler) ;
checkStmt.execute( );
}
-- 
Berkay UNAL
[EMAIL PROTECTED] com



  

[flexcoders] Turning off SWF messages

2008-08-05 Thread Laurent Cozic
Each time a SWF file is loaded, Flash display a message in the console window 
such as:

[SWF] /myfile.swf - 6,303 bytes after decompression

This clutters the window for no real usefulness, especially when many files are 
loaded at the same time. Is it possible to turn this feature off and, if so, 
how?

 

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



  

Re: [SPAM]Re: [flexcoders] Delay before text is updated

2008-08-05 Thread Laurent Cozic
Try savingMessage.validateNow() - it should force an update of the text area.


 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: Paul Steven [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, August 5, 2008 9:33:56 AM
Subject: RE: [SPAM]Re: [flexcoders] Delay before text is updated


Thanks for the replies.
 
My method basically creates a fairly large string and then
writes this string to disk as an xml file.
 
So are you saying, if my function takes say 10 seconds to
complete, there will be no ENTER_FRAME dispatched during this time? If so then
is there any function I can call to force an update to the screen – something 
like
updateScreen( ) ?
 
Thanks
 
Paul
 
From:[EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf 
Of Josh McDonald
Sent: 05 August 2008 08:56
To: [EMAIL PROTECTED] ups.com
Subject: [SPAM]Re: [flexcoders] Delay before text is updated
 
What does your method do?

Most changes made to most components (such as changing the text property) won't
be reflected on-screen until the next ENTER_FRAME is dispatched by the player
due to the way Flex works internally. If your method is simply some gigantic or
slow loop, you won't see anything until it's done- and you should probably
split it apart and schedule it in pieces :)

-Josh
On Tue, Aug 5, 2008 at 5:43 PM, Paul Steven paul_steven@ btinternet. com
wrote:
Probably something really
basic, but I am having trouble with delays updating some text on screen.
 
Basically I want to display a
message on screen to tell the user to wait whilst a save operation takes place
and after the save operation change the text message back to blank. However I
am not seeing this update. Here is the code
 
savingMessage. text =
Saving. Please wait...;
   

_dataManager. createStudentDat aXMLFile( ); 
 
savingMessage. text =
;
 
 
Please note the
createStudentDataXM LFile function takes about 10 seconds to complete so in
theory the Saving. Please wait... message should appear for this
time. If I put an alert in before the calling of the createStudentDataXM LFile
function, then the text updates correctly.
 
I have also experienced similar
problems trying to get a busy cursor to appear using the cursor
manager and a call such as CursorManager. setBusyCursor( );
 
Again, the problem here is the
cursor is not updating as soon as I call the function.
 
Anyone any ideas why these
things are not updating on screen immediately?
 
Thanks
 
Paul
 
p.s I am using Flex Builder and
packaging in Zinc 2.5



-- 
Therefore, send not to know For whom the bell tolls. It tolls for
thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] com 


  

Re: [flexcoders] Re: modifying a function at runtime

2008-08-05 Thread Laurent Cozic
I wouldn't recommend it, but you can do it using a dynamic class:

package {
  public dynamic class YourClass {
// Define the function this way:
this.yourFunction = function() {
  return abcd;
}
  }
}


// Then to change the function:
var test = new YourClass()

trace(test.yourFunction()); // abcd

test.yourFunction = function() {
   return 1234
}

trace(test.yourFunction()); // 1234



--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: arieljake [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, August 5, 2008 11:18:53 AM
Subject: [flexcoders] Re: modifying a function at runtime


ehem...was a little sleepy when I wrote that. I meant...

Is it possible to modify the method of a class at runtime?

The only way I can think of is to encapsulate the function into a
Function property that gets called by a wrapper class method.




  

Re: [flexcoders] TextArea - Limit the amount of text

2008-08-05 Thread Laurent Cozic
You could do it by listening to the textInput event. When it's triggered, check 
if the text height is above a certain limit (for example the TextArea height - 
font height): if it is, cancel the event.

The code below should work:


textArea.addEventListener(TextEvent.TEXT_INPUT, textArea_textInput);

protected function textArea_textInput(event:TextEvent) {
if (textArea.textHeight  textArea.height - textArea.getStyle(fontSize)) {
event.preventDefault();
}
}



--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: tchredeemed [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, August 5, 2008 2:27:55 PM
Subject: [flexcoders] TextArea - Limit the amount of text


I am creating a web-to-print Greeting Card Editor.

I need to limit the amount of text someone can put in the editable
field (obviously cannot print more than the printable area).

I cant just do maxChars, because it can fit variable amount depending
on the amount of i's and w's used, etc!

any help is appreciated.




  

Re: [flexcoders] Re: TextArea - Limit the amount of text

2008-08-05 Thread Laurent Cozic
I haven't checked but I guess that the TextEvent.text property is empty if you 
are deleting text. If that's the case, then don't cancel the event.

 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: tchredeemed [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, August 5, 2008 2:57:32 PM
Subject: [flexcoders] Re: TextArea - Limit the amount of text


Ok, that is definitely a step in the right direction.

1 problem:

After they hit that max, it doesn't allow them to go back and change
old text that they already edited, because the textHeight has been
reached, so it prevents them from changing (essentially setting
enabled=false) .

Any ideas?

--- In [EMAIL PROTECTED] ups.com, Laurent Cozic pogopixels@ ... wrote:

 You could do it by listening to the textInput event. When it's
triggered, check if the text height is above a certain limit (for
example the TextArea height - font height): if it is, cancel the event.
 
 The code below should work:
 
 
 textArea.addEventLi stener(TextEvent .TEXT_INPUT, textArea_textInput) ;
 
 protected function textArea_textInput( event:TextEvent) {
 if (textArea.textHeigh t  textArea.height -
textArea.getStyle( fontSize )) {
 event.preventDefaul t();
 }
 }
 
 
 
 --
 Laurent Cozic
 
 Flash, Flex and Web Application development
 http://pogopixels. com
 
 
 
 - Original Message 
 From: tchredeemed [EMAIL PROTECTED] 
 To: [EMAIL PROTECTED] ups.com
 Sent: Tuesday, August 5, 2008 2:27:55 PM
 Subject: [flexcoders] TextArea - Limit the amount of text
 
 
 I am creating a web-to-print Greeting Card Editor.
 
 I need to limit the amount of text someone can put in the editable
 field (obviously cannot print more than the printable area).
 
 I cant just do maxChars, because it can fit variable amount depending
 on the amount of i's and w's used, etc!
 
 any help is appreciated.





  

Re: [flexcoders] Re: TextArea - Limit the amount of text

2008-08-05 Thread Laurent Cozic
Yes that's right, that wouldn't work in that case. Then one solution would be 
to save the text property when you know it's below the limit (for example in 
the TextInput event), then in the CHANGE event, check the text height again. If 
it's above the limit, restore the previous text property. You might also want 
to save and restore the caret position as well (see selectionStartIndex and 
selectionEndIndex)


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: tchredeemed [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, August 5, 2008 3:07:37 PM
Subject: [flexcoders] Re: TextArea - Limit the amount of text


no no, thats not the issue

the issue is this

a
b
c

is a certain textHeight, whether the cursor is on the a or the c, so
if they hit that textHeight, then no matter whree they put the cursor,
the textHeight is at the limit, so i prevent the default.

if I delete the c, the textHeight is no longer at its limit, so I can
edit anywhere I want.

make sense?

--- In [EMAIL PROTECTED] ups.com, Laurent Cozic pogopixels@ ... wrote:

 I haven't checked but I guess that the TextEvent.text property is
empty if you are deleting text. If that's the case, then don't cancel
the event.
 
  --
 Laurent Cozic
 
 Flash, Flex and Web Application development
 http://pogopixels. com
 
 
 
 - Original Message 
 From: tchredeemed [EMAIL PROTECTED] 
 To: [EMAIL PROTECTED] ups.com
 Sent: Tuesday, August 5, 2008 2:57:32 PM
 Subject: [flexcoders] Re: TextArea - Limit the amount of text
 
 
 Ok, that is definitely a step in the right direction.
 
 1 problem:
 
 After they hit that max, it doesn't allow them to go back and change
 old text that they already edited, because the textHeight has been
 reached, so it prevents them from changing (essentially setting
 enabled=false) .
 
 Any ideas?
 
 --- In [EMAIL PROTECTED] ups.com, Laurent Cozic pogopixels@ ...
wrote:
 
  You could do it by listening to the textInput event. When it's
 triggered, check if the text height is above a certain limit (for
 example the TextArea height - font height): if it is, cancel the event.
  
  The code below should work:
  
  
  textArea.addEventLi stener(TextEvent .TEXT_INPUT,
textArea_textInput) ;
  
  protected function textArea_textInput( event:TextEvent) {
  if (textArea.textHeigh t  textArea.height -
 textArea.getStyle( fontSize )) {
  event.preventDefaul t();
  }
  }
  
  
  
  --
  Laurent Cozic
  
  Flash, Flex and Web Application development
  http://pogopixels. com
  
  
  
  - Original Message 
  From: tchredeemed apthorp@ 
  To: [EMAIL PROTECTED] ups.com
  Sent: Tuesday, August 5, 2008 2:27:55 PM
  Subject: [flexcoders] TextArea - Limit the amount of text
  
  
  I am creating a web-to-print Greeting Card Editor.
  
  I need to limit the amount of text someone can put in the editable
  field (obviously cannot print more than the printable area).
  
  I cant just do maxChars, because it can fit variable amount depending
  on the amount of i's and w's used, etc!
  
  any help is appreciated.
 





  

Re: [flexcoders] Re: How to show the Hand Cursor on the Close Button?

2008-08-05 Thread Laurent Cozic
Add the mx_internal declarations at the top of your class:

import mx.core.mx_internal;
use namespace mx_internal;


 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: flexawesome [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, August 5, 2008 3:33:56 PM
Subject: [flexcoders] Re: How to show the Hand Cursor on the Close Button?


The button is at the TOP/LEFT corner in the TitleWindow.

it shows the error msg below... any suggestions? 

1120: Access of undefined property mx_internal.

--- In [EMAIL PROTECTED] ups.com, Claudiu Ursica the_braniak@ ... 
wrote:

 var btn:Button = this.mx_internal: :closeButton;
 btn.useHandCursor = true;
 
 However the mx:internal might change in the future so this is not
 bullet proof.
 
 
 --- In [EMAIL PROTECTED] ups.com, flexawesome flexawesome@  
wrote:
 
  Hey there,
  
  In the titlewindow component, I set showCloseButton = true; Do 
you know 
  how can I show the Hand Cursor on the Close button?
  
  Thanks
 





  

Re: [flexcoders] SWFObject URL

2008-08-05 Thread Laurent Cozic
This would only return the SWF file URL, not the URL of the page within which 
it is embedded. To do that, you'll have to use javascript and the 
ExternalInterface class:

ExternalInterface.call(document.location);

 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: Tom Chiverton [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, August 5, 2008 4:08:11 PM
Subject: Re: [flexcoders] SWFObject URL

On Tuesday 05 Aug 2008, flexaustin wrote:
 Is it possible to obtain the URL of the page the swf is embedded in
 from within the Flex object.

Application.application.url


-- 
Tom Chiverton



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
of members is available for inspection at the registered office. Any reference 
to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  
Regulated by The Solicitors Regulation Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.halliwells.com.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links




  

Re: [flexcoders] Fading out text

2008-08-01 Thread Laurent Cozic
Hi,

You need to use an embedded font in order for the fade effect to work. Simply 
create a new style for your text, then tick the Embed this font check box in 
the style properties.

 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: cesarerocchi [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Friday, August 1, 2008 11:36:35 AM
Subject: [flexcoders] Fading out text


Hi,

I have a canvas containing text. When I fadeout the canvas, via mxml fade 
effect, the canvas 
fades out but the text does not. 
How can I fade out the canvas and the text together?

Cheers,

-c.




  

Re: [flexcoders] Re: Fading out text

2008-08-01 Thread Laurent Cozic
Actually it doesn't really matter what the defautl font is or if it's installed 
on the user's system or not. If you want to change the alpha, rotation or, in 
general, use any effect on a text component, you have to embed the font.

This is actually a limitation of the Flash Player, not Flex, so there's not 
much we can do about it. If I'm not mistaken, this limitation will be gone in 
Flash 10 though.

 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: cesarerocchi [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Friday, August 1, 2008 3:50:42 PM
Subject: [flexcoders] Re: Fading out text


 You need to use an embedded font in order for the fade effect to work. Simply 
 create a 
new style for your text, then tick the Embed this font check box in the style 
properties.

Thanks for the quick reply.
A follow up question.
What if I am ok with the default font (I work in Adobe Air) and I didn't embed 
any font in my 
application?
Isn't that font, the default one, already embedded? If not, what's the name of 
the default 
font?

Thanks,

-c.




  

Re: [flexcoders] Re: problem adding images to UIComponents using AS3

2008-08-01 Thread Laurent Cozic
I didn't read the other replies, but in general I think it's not a good idea to 
add a Flex component to a non-Flex object. You might be able to get it to work 
by simulating the framework workflow - for example, by manually calling all the 
invalidateXX methods, however it's not a very clean approach.

In this case, a better way would be to directly create an instance of your 
embedded object and add it to the display list. I think the syntax would be:

var image:BitmapAsset = new _moveGroupImage() as BitmapAsset ; 
this.addChild(image);


 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: Merrill, Jason [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Friday, August 1, 2008 4:57:36 PM
Subject: [flexcoders] Re: problem adding images to UIComponents using AS3


OK, let me back up here.  First, thanks to those who responded.   So I thought 
by isolating my problem with an example (heck, I'm not even using Canvas) it 
would shed light on why this bug is occuring, but it isn't unfortunately, I'm 
more or less confusing the real problem with y'all. Sorry.  So maybe what I 
thought was the problem was instead something else.  
Here is my actual project code, and a description of the setup.  The problem 
is, the image is not getting attached to the sprite, even though the sprite is 
showing up in the display list just fine (the graphics draw from code - but the 
image doesn't show).  I know the path to the image is right, I can use the same 
embed and new Image() code elsewhere in my app to make the image appear.  Here 
is the code and the setup in the application:
package com.venice.view. network.grouping Tool  
{ 
import flash.display. Sprite; 
import mx.controls. Image; 

public class GroupHandle extends Sprite 
{ 
public var id:int; 

public const FILL_COLOR:uint = 0xff; 
public const FILL_ALPHA:Number = .5; 
public const STROKE_COLOR: uint = 0x00; 
public const STROKE_THICKNESS: Number = 1; 
public const STROKE_ALPHA: Number = 1.0; 
public const SIZE:Number = 10; 

[Embed(source = /media/icons/ control_repeat_ blue.png)] 
[Bindable] 
private var _moveGroupImage: Class; 

public function GroupHandle( ):void 
{ 
//this works: 
graphics.clear( ); 
graphics.lineStyle( STROKE_THICKNESS , STROKE_COLOR, 
STROKE_ALPHA) ; 
graphics.beginFill( FILL_COLOR, FILL_ALPHA); 
graphics.drawRect( -(SIZE/2) , -(SIZE/2), SIZE/2, 
SIZE/2); 
graphics.endFill( ); 

//this doesn't: 
var icon:Image = new Image(); 
icon.source = _moveGroupImage; 
addChild(icon) ; 
} 
} 
} 
This class, GroupHandle. as, which extends Sprite, is added in the display list 
in my application as follows: 
Application(main MXML)   network(Panel based MXML component)  groupsLayerUI 
(a UIComponent, necessary because it's added to a Panel container) 
groupingTool(.as class that extends Sprite) groupHandle(.as class that 
extends Sprite)
The groupsLayerUI UIComponent seems to be fine holding other content, and even 
in the groupHandle, it renders drawn graphics just fine. Just not the image. 
Even if I size the UIComponent, it doesn't work.  It's not making any sense to 
me why this image doesn't appear in this sprite, even though it will appear in 
other places in my app, and even though other graphics in the sprite appear 
fine.  I thought maybe it had something to do with also drawing on the same 
sprite, but that's not it either, I removed that code and it still fails to 
load the embedded image.  Can someone figure out what could be wrong?  Thanks.

Jason Merrill
Bank of America 
Enterprise Technology  Global Risk LLD
Instructional Technology  Media 
Join the Bank of America Flash Platform Developer Community 
Are you a Bank of America associate interested in innovative learning ideas and 
technologies?
Check out our internal  GTO Innovative Learning Blog  subscribe. 



  

Re: [flexcoders] Re: problem adding images to UIComponents using AS3

2008-08-01 Thread Laurent Cozic
Hi,

 Or do you mean Image is a Flex component and not good to 
 add to a custom sprite?

Yes that's what I meant. By non-Flex I meant an object that is not part of 
the mx.* package, i.e. not part of the Flex Framework. A Sprite is a native 
Flash object and doesn't know how to display or size a Flex object.

--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: Jason [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Friday, August 1, 2008 6:49:50 PM
Subject: [flexcoders] Re: problem adding images to UIComponents using AS3


Thanks, I'll try that, but what is the non-Flex object you're 
referring to?  My Sprite classes?  If so, it's the other way around, 
I'm adding them to a Flex container. If you mean the custom MXML 
components, then no, I'm adding them to a Flex component, not the other 
way around. Or do you mean Image is a Flex component and not good to 
add to a custom sprite?  If so, that's an odd limitation, but sounds 
faesible since this bug isn't making any sense to me anyway. 




  

Re: [flexcoders] Re: Sandbox violation running from Builder. How did I get this and how do I fix it?

2008-07-31 Thread Laurent Cozic
Did you try putting your assets directory inside src? I think that should 
work fine.

 -- Laurent Cozic


Flash, Flex and Web Application development 
http://pogopixels.com





- Original Message 
From: jamalwally [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, July 31, 2008 4:09:47 PM
Subject: [flexcoders] Re: Sandbox violation running from Builder. How did I get 
this and how do I fix it?


I also get a security sandbox violation error on a flex project
after checking out from SVN. 

I have a flex project that compiles and runs fine on the original
development computer.  I then check in my source code to an SVN
repository.  When a fellow developer checks the project out from SVN
and tries to compile on their system, they encounter the security
sandbox violation error.

My flex application never tries to access a remote file.  The security
sandbox violation occurs while trying to access a local XML file in
the project directory (source code in src/, swf in bin-debug/ and xml
file in assets/ --- all three are sister directories) .

If anyone has figured out the solution to this puzzle, please post!

Best wishes,
-- j

--- In [EMAIL PROTECTED] ups.com, Josh McDonald [EMAIL PROTECTED] wrote:

 It was *something* funky caused by svn checkout.
 
 First I check out via builder to my workspace (file location as well as
 create project) and I got the problem.
 
 I checked out to a directory completely separate from my workspace via
 another SVN client, and then copied the tree to the builder workspace
 directory and created a new project in Builder, still didn't work.
 
 Finally I created yet another project, quit flex, copied the /src
directory
 from my checkout, deleted all dotfiles (svn and whatever else) with
a find |
 grep | xargs rm and re-started flex, and now it works (but it's not
checked
 out, just effectively exported).
 
 The workspace isn't listed in Flash Player's trusted locations
through the
 advanced settings UI, so it'd be really nice to know how the player
 determines what is and isn't a builder swf, so I can take whatever's
causing
 the damned problem out of SVN (or put it back in if it's missing
something)
 - and also let other devs on the list and in my office know what to
look out
 for :)
 
 -Josh
 
 On Fri, Jun 6, 2008 at 12:51 PM, Bjorn Schultheiss 
 bjorn.mailinglists@ ... wrote:
 
Are you sure its not a security settings related issue..
 
 
www.macromedia. com/support/ documentation/ en/flashplayer/ help/settings_ 
manager04. html
 
  --- In [EMAIL PROTECTED] ups.com flexcoders% 40yahoogroups. com,
Rick
  Winscot rick.winscot@ 
  wrote:
 
  
   Also. where is the project 'physically' located? I would strongly
  recommend
   making sure that the project is inside your workspace. Are there any
   compiler options like -use-network= false present?
  
  
  
   Rick Winscot
  
  
  
  
  
   From: [EMAIL PROTECTED] ups.com flexcoders% 40yahoogroups. com
[mailto:
  [EMAIL PROTECTED] ups.com flexcoders% 40yahoogroups. com] On
   Behalf Of Tracy Spratt
   Sent: Thursday, June 05, 2008 9:03 PM
   To: [EMAIL PROTECTED] ups.com flexcoders% 40yahoogroups. com
   Subject: RE: [flexcoders] Sandbox violation running from Builder.
  How did I
   get this and how do I fix it?
  
  
  
   Very strange. There was a similar thread a couple days ago and we
  did not
   find a solution, as far as I know.
  
  
  
   Did you create the new project by don't New Project and then copying
  in the
   files, or did you import the other project? (the first, I know, but
  maybe
   try the second?)
  
  
  
   Maybe try removing the application from the project's application
  list and
   then re-adding it?
  
  
  
   Tracy
  
  
  
   _
  
   From: [EMAIL PROTECTED] ups.com flexcoders% 40yahoogroups. com
[mailto:
  [EMAIL PROTECTED] ups.com flexcoders% 40yahoogroups. com] On
   Behalf Of Josh McDonald
   Sent: Thursday, June 05, 2008 8:42 PM
   To: [EMAIL PROTECTED] ups.com flexcoders% 40yahoogroups. com
   Subject: [flexcoders] Sandbox violation running from Builder. How
  did I get
   this and how do I fix it?
  
  
  
   I've checked out a project into the same directory as all my other
  projects,
   and now I'm getting a security sandbox violation trying to load a
  local file
   even when running from Flex. What could cause this? And how do I get
  it back
   to behaving the way it should for all builder projects?
  
   -J
  
   --
   Therefore, send not to know For whom the bell tolls. It tolls for
  thee.
  
   :: Josh 'G-Funk' McDonald
   :: 0437 221 380 :: josh@
  
 
  
 
 
 
 
 -- 
 Therefore, send not to know For whom the bell tolls. It tolls for
thee.
 
 :: Josh 'G-Funk' McDonald
 :: 0437 221 380 :: [EMAIL PROTECTED]





  

Re: [flexcoders] Chart: pass info about series1 to series2 lineSegmentRenderer callback?

2008-07-31 Thread Laurent Cozic
Normally, the way to pass parameters to the item renderer is through its data 
property. So just make sure that your data provider contains whatever 
information you need to set the item renderer position.

 -- Laurent Cozic


Flash, Flex and Web Application development 
http://pogopixels.com



- Original Message 
From: chigwell23 [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, July 31, 2008 4:33:54 PM
Subject: [flexcoders] Chart: pass info about series1 to series2 
lineSegmentRenderer callback?


First question is whether I can pass actual parameters to a callback
in the first place? This is what I need to do:

mx:ColumnSeries id=salesSeries
yField=sales 
/mx:ColumnSeries

mx:LineSeries id=percSeries
yField=percent 
lineSegmentRenderer =PercentLineRen derer(orig callback params,
new  callback params)
/mx:LineSeries

Conventionally of course the lineSegmentRenderer gets no params as a
callback. But in this instance I need to manipulate the position of
the  percent line series lines through the renderer based on sales
series data so that the lines are positioned exactly over the columns
of the sales series. I have code in the renderer that positions the
lines, but different underlying data for the column series (2 side by
side cols for each data point), changes the width and horizontal
position of the columns and then the percent line fragments above no
longer line up.

If I could get the sales series info to the percent series
renderer I think I stand a chance of coding interacting series

A big thank you in advance,

Mic.




  

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Laurent Cozic
How about:

sNaN(mynumber) ? 0 : 

 --
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com



- Original Message 
From: Blair Cox [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, July 31, 2008 5:19:46 PM
Subject: Re: [flexcoders] NaN and Infinity showing in output - How to modify?


Just one more question. The zero works for me, but I’m sure I’ll be asked to 
make it blank. Any hints as to how this could be accomplished? Coming from the 
Flash side of things, all I would be looking to do is change the alpha value of 
the label to zero if the value was 0.


isNaN(mynumber) ? 0 :


-- 
Blair Cox

http://www.luminult ra.com






From: Sid Maskit [EMAIL PROTECTED] com
Reply-To: [EMAIL PROTECTED] ups.com
Date: Thu, 31 Jul 2008 07:51:38 -0700 (PDT)
To: [EMAIL PROTECTED] ups.com
Subject: Re: [flexcoders] NaN and Infinity showing in output - How to modify?

 
 

If the format function is a custom function you have written, you could just 
have it check whether you like the result it is about to return, and if not, 
return something else. If that is not the case, I believe that you should be 
able to put tests into your binding statement. 

You could test for NaN with something like this:

mx:Label text={(myNumber is NaN) ? 0 : PrepForDispl ay.format( myNumber) }/

I'm not sure about infinity, but I assume that you can test for this by looking 
for the greatest possible value of the number. Assuming that you have set up 
the variable maxValue to contain that value, you should be able to do something 
like this:

mx:Label text={(myNumber  maxValue) ? 0 : PrepForDispl ay.format( myNumber) 
}/

If you put the two together, it would look something like this:

mx:Label text={(myNumber is NaN) ? 0 : (myNumber  maxValue) ? 0 : 
PrepForDispl ay.format( myNumber) }/

 
Sid Maskit
Partner 
CraftySpace
Better Websites for a Better World
http://www.CraftySp ace.com
blog: http://smaskit. blogspot. com/
 


  

[flexcoders] Re: How do you identify a component created in a repeater????

2008-07-29 Thread Laurent Cozic
Within which context? If you need to know which component has
triggered an event, you can use event.currentTarget, as in:

yourRepeatedComponent click=clickHandler(event) /

Then in a script block:

function clickHandler(event) {
  var yourComponenet = event.currentTarget;

  // From then you can also get this.parent.getChildAt(n)
  // to get the other components
}