Re: [Flashcoders] Reliable way to split a string into an array of lines?
I find this fast and reliable... var lines:Array = str.split (\r\n).join(\n).split(\r).join(\n).split(\n); On 9/13/07, Mark Winterhalder [EMAIL PROTECTED] wrote: var lines : Array = (str.indexOf( \r\n ) -1) ? str.split( \r\n ) : str.split( \n ); Or, if you want to take MacOS 9 into account: var lines : Array; if( str.indexOf( \r\n ) -1 ) { lines = str.indexOf( \r\n ); } else if( str.indexOf( \n ) -1 ) { lines = str.split( \n ); } else if( str.indexOf( \r ) -1 ) { lines = str.split( \r ); } else { lines = str; } (You don't actually need the default, splitting on a non-existing string should return an array of length 1. It's just more clear that way.) HTH, Mark On 9/12/07, Danny Kodicek [EMAIL PROTECTED] wrote: I'm looking for a simple, reliable method for splitting a string into its constituent lines (at the hard line breaks - this isn't a text wrapping thing). The problem is that line breaks could be Chr(10) or Chr(13), or indeed both. I've done this: myArr = myStr.split(String.fromCharCode(10)).join(String.fromCharCode (13)).split(Str ing.fromCharCode(13)) I'm guessing I'm better off going the RegEx route, but I was wondering if there's a quicker, simpler way. Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Convert URLs in a string to links
Well, simplest is to use one of the many regex classes out there, failing that 8--8--8--8--8--8--8--8-- var test = Some link http://test.com and another http://www.berty.co.uklets test.; var markedUp = ; var h = test.split(http://;); var idx = test.indexOf(http://;); var i = idx == 0 ? 0 : 1; if(idx != -1) { for(; ih.length; i++) { var t = h[i].split( ); var href = t[0]; var r = ; if(t.length 1) { href = t.shift(); r = t.join( ); } h[i] = a href=\http://; + href + \ + href + /a + r; } markedUp = h.join(); } else markedUp = test; trace(markedUp); 8--8--8--8--8--8--8--8-- On 6/26/07, Mick G [EMAIL PROTECTED] wrote: Can anyone think of an efficient way to convert a URL (or multiple URLs) in a string to a link. eg. myString = this website http://www.this.com is really cool; would convert to: this website a href='http://www.this.com' http://www.this.com/a is really cool. I tried splitting the string at http://; the splitting that again at a space and... anyway, no luck here :) Any help appreciated. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Re: Asynchronous ExternalInterface Calls From Javascript, possible?
I suspect the first call delay is to do with flash getting a wsdl file (if its a SOAP service). Once it has the wsdl, it needs not d/load it again. On 6/21/07, elibol [EMAIL PROTECTED] wrote: Hmm, I think it checks for the crossdomain.xml file when the webservice attempts to load/connect. Simple access to a file on a remote (sub)domain is not allowed. On 6/20/07, jason vancleave [EMAIL PROTECTED] wrote: Seth Green seth.m.green at gmail.com writes: It turns out that the asynchronous web service call actually takes some extra time (like 100ms) the FIRST time you use that web service method. Not to confuse the matters worse but I wonder if that has something to do with it looking for the a crossdomain.xml file. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] how to get CDATA into an XML object
trace(nodeType :+child.nodeType); trace(nodeValue :+child.nodeValue); should read trace(nodeType :+child.firstChild.nodeType); trace(nodeValue :+child.firstChild.nodeValue); On 6/20/07, Charles Parcell [EMAIL PROTECTED] wrote: I believe the entire thing has to be inside the CDATA. var xmlRecord = new XML(![CDATA[html + some arbitrary string + /html]]); Charles P. On 6/20/07, Andrew Sinning [EMAIL PROTECTED] wrote: How can I load in a schema that has a CDATA node if AS2 doesn't support it? Where do I get the valid schema? In theory, the following is creating an xml object with a CDATA node, but it doesn't appear to work: var xmlRecord = new XML(html![CDATA[ + some arbitrary string + ]]/html); var child = xmlRecord.firstChild; trace(nodeType :+child.nodeType); trace(nodeName :+child.nodeName); trace(nodeValue :+child.nodeValue); /* ouput: nodeType :1 nodeName :html nodeValue :null */ David Ngo wrote: AS2 will not support CDATA nodes. You should load in a schema that has a CDATA node first, then use that schema to write your text nodes to the CDATA node and pass the instance of the schema w/ the CDATA intact. I've had to use this work-around for another project I worked on a year ago. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Asynchronous ExternalInterface Calls From Javascript, possible?
You could make use of ExternalInterface.addCallback. Therefore the JS function you call with ExternalInterface.call starts some process off then returns straight away. When your process is done it calls your registered flash callback. Therefore you end up with asynchronous. All said and done, why not call the webservice straight from flash? On 6/19/07, Seth Green [EMAIL PROTECTED] wrote: I have a web app that uses a flash movie as a proxy to a web service. Therefore, I have javascript calling flash methods that in turn make requests to a web service and then route the response back to javascript. I don't need my javascript functions to wait on this calls, but ExternalInterface is inherently synchronous. And to my surprise I have found that a flash method which does nothing but make a web service request can take 100ms or more. This is unacceptably slow, but especially so since my javascript code has to hang while the flash method does its business. Does anyone have any experience with this issue, or can provide a workaround or hint as to how I might make these calls asynchronous? thanks in advance. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] AS3 new Class from string
In AS3 is done like this... import flash.utils.getDefinitionByName; var ObClass:Class = getDefinitionByName( fully.qualified.class.name ) as Class; var instance = new ObClass(); On 6/18/07, elibol [EMAIL PROTECTED] wrote: Not sure since eval() is gone. Try keeping a reference for each class in some object and use it like a hash map. import Circle; import Square; import Triangle; var classes:Object { Circle:Circle , Square:Square , Triangle:Triangle }; var list:Array = new Array(Circle,Square,Triangle); for(var i=0;ilist.length;i++){ var cls:Class = classes[list[i]]; var instance:* = new cls(); } It would be nice to see a less involved solution though... On 6/18/07, Patrick Matte|BLITZ [EMAIL PROTECTED] wrote: Hey fellows, in AS3 how can I create class instances from a list of classes names. Take for example something like this: import Circle; import Square; import Triangle; var list:Array = new Array(Circle,Square,Triangle); for(var i=0;ilist.length;i++){ var class = new list[i](); } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] AS3 new Class from string
Jim: getDefinitionByName(flash.display::Sprite); Should read: getDefinitionByName(flash.display.Sprite); I think. On 6/18/07, jtgxbass [EMAIL PROTECTED] wrote: In AS3 is done like this... import flash.utils.getDefinitionByName; var ObClass:Class = getDefinitionByName( fully.qualified.class.name ) as Class; var instance = new ObClass(); On 6/18/07, elibol [EMAIL PROTECTED] wrote: Not sure since eval() is gone. Try keeping a reference for each class in some object and use it like a hash map. import Circle; import Square; import Triangle; var classes:Object { Circle:Circle , Square:Square , Triangle:Triangle }; var list:Array = new Array(Circle,Square,Triangle); for(var i=0;ilist.length;i++){ var cls:Class = classes[list[i]]; var instance:* = new cls(); } It would be nice to see a less involved solution though... On 6/18/07, Patrick Matte|BLITZ [EMAIL PROTECTED] wrote: Hey fellows, in AS3 how can I create class instances from a list of classes names. Take for example something like this: import Circle; import Square; import Triangle; var list:Array = new Array(Circle,Square,Triangle); for(var i=0;ilist.length ;i++){ var class = new list[i](); } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] How can we sum to dates???
Just use flash's Date class and work with milliseconds... var startDate = new Date(2007,0,14,11,30,0,0); var duration = 50 * 60 * 1000; // in milliseconds var endDate = new Date(startDate.getTime() + duration); On 6/16/07, eka [EMAIL PROTECTED] wrote: Hello :) i have update my SVN repository and add a new feature in the static add method of the Calendar class : import asgard.date.Calendar ; var begin:Calendar = new Calendar( 2007, 5 , 14, 11, 30, 0 ) ; var duration:Number = 50 ; var end:Calendar = Calendar.add( begin, Calendar.MINUTE , 50 ) ; var sBegin:String = begin.format(MM dd hh:nn:ss) ; var sFinish:String = end.format(MM dd hh:nn:ss) ; trace( start : + sBegin ) ; trace( finish : + sFinish ) ; It's more easy now ;) EKA+ :) 2007/6/16, eka [EMAIL PROTECTED]: Hello :) if you have 2 minutes : 1 - install VEGAS my opensource framework and this extensions : - page project : http://code.google.com/p/vegas/ - install VEGAS : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN 2 - Use the Calendar and the Time class in the asgard package : asgard.date.Calendar : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/asgard/date/Calendar.as asgard.date.Time : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/asgard/date/Time.as Example : import asgard.date.Calendar ; import asgard.date.Time ; var begin:Calendar = new Calendar( 2007, 5 , 14, 11, 30, 0 ) ; var duration:Number = 50 * Time.MINUTE ; // in milliseconds var end:Calendar = new Calendar( begin.valueOf() + duration ) ; var sBegin:String = begin.format(MM dd hh:nn:ss) ; var sFinish:String = end.format(MM dd hh:nn:ss) ; trace( start : + sBegin ) ; // start : Jun 14 2007 11:30:00 trace( finish : + sFinish ) ; // finish : Jun 14 2007 12:20:00 EKA+ :) var end:Calendar = Calendar.add( begin , Calendar.MINUTES 2007/6/16, Amandeep Singh [EMAIL PROTECTED]: Hi everyone, I got stuck in a problem. What i need is to sum to dates. Let say there is an event that starts at Jun 14 2007 11:30:00. The duration of the event is 50 min. That means the end time will be Jun 14 2007 12:20:00. Now what i need is to sum the start time and the duration to get the end time. Anyone who know how to do this please let me know. I will be very thankful. Thanks in Advance. Regards, Amandeep ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] examples of scripting the Flash application?
Show a browse for file dialog: var fileURL = fl.browseForFileURL(open, Select file); Suggest you read the docs: http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part7_Extending.html as already mentioned by Muzak On 6/7/07, Roy Pardi [EMAIL PROTECTED] wrote: At 11:53 AM +0200 6/7/07, Muzak wrote: And wich part are you having problems with? Well, I've been digging around for examples (for instance, of opening a file picker) so I can see JSFL in action along with info on any dead ends or other issues that would indicate that what I want to do isn't possible. Guess I was too vague about what I want to try to do- basically, within the Flash app: 1. user opens a template movie that contains a Library of movieClips 2. user selects my command from the menu 3. the command opens a file picker dialog box where they can select a previously created XML file 4. my command parses the XML file and instances the appropriate movieClip from the librbary, setting name text props from the XML data 5. my command opens a save as dialog so the file can be saved 6. user can adjust/tweak positions of added MCs and then publish the swf. (just thinking out loud here) -- - Studio Site Updated! http://www.roypardi.com/ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] [OT] desktop file searching utility
You can use grep on windows. Install cygwin. On 5/29/07, Hairy Dog Digital [EMAIL PROTECTED] wrote: Windows dude... not Linux! -Original Message- From: jtgxbass [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 2:20 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] [OT] desktop file searching utility grep -rl --include='*.as' 'class NonGUI' . On 5/29/07, Hairy Dog Digital [EMAIL PROTECTED] wrote: Thanks Bojil, I was looking at their web page and see that one of the features is file comparison/synching. Their feature list is rather impressive: search, compare, synch, reg expressions, etc. ...Rob -Original Message- From: Bojil Vassilev [mailto:[EMAIL PROTECTED] Sent: Monday, May 28, 2007 4:30 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] [OT] desktop file searching utility Hi, A general purpose desktop app that does this, and a lot, lot more, is Total Commander. I cannot recommend enough this little app - give it a try. Regards, Bojil ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] [OT] desktop file searching utility
Thats why we have google ;) On 5/30/07, Hairy Dog Digital [EMAIL PROTECTED] wrote: Okay. But, I'm not a mindreader. -Original Message- From: jtgxbass [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 30, 2007 4:42 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] [OT] desktop file searching utility You can use grep on windows. Install cygwin. On 5/29/07, Hairy Dog Digital [EMAIL PROTECTED] wrote: Windows dude... not Linux! -Original Message- From: jtgxbass [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 2:20 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] [OT] desktop file searching utility grep -rl --include='*.as' 'class NonGUI' . On 5/29/07, Hairy Dog Digital [EMAIL PROTECTED] wrote: Thanks Bojil, I was looking at their web page and see that one of the features is file comparison/synching. Their feature list is rather impressive: search, compare, synch, reg expressions, etc. ...Rob -Original Message- From: Bojil Vassilev [mailto:[EMAIL PROTECTED] Sent: Monday, May 28, 2007 4:30 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] [OT] desktop file searching utility Hi, A general purpose desktop app that does this, and a lot, lot more, is Total Commander. I cannot recommend enough this little app - give it a try. Regards, Bojil ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] [OT] desktop file searching utility
grep -rl --include='*.as' 'class NonGUI' . On 5/29/07, Hairy Dog Digital [EMAIL PROTECTED] wrote: Thanks Bojil, I was looking at their web page and see that one of the features is file comparison/synching. Their feature list is rather impressive: search, compare, synch, reg expressions, etc. ...Rob -Original Message- From: Bojil Vassilev [mailto:[EMAIL PROTECTED] Sent: Monday, May 28, 2007 4:30 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] [OT] desktop file searching utility Hi, A general purpose desktop app that does this, and a lot, lot more, is Total Commander. I cannot recommend enough this little app - give it a try. Regards, Bojil ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Flex question : setting listeners and component parameters from the class
in mxml: ... lcModel = new DirectoryBrowser(this) ... in class: ... public class DirectoryBrowser{ private var btn:Button; private var txt:Text; public function DirectoryBrowser(owner):void{ btn = owner.btn; txt = owner.txt; setStuff() Alert.show(class loaded,class debug) } ... that said, ugly way to achieve what your after. if you want AS seperate from mxml, just use a seperate .as file and use the src attribute on the Script element. On 3/23/07, lostchild [EMAIL PROTECTED] wrote: Hi... What i want to manage is, seperating the code from the mxml completely. And here is my attempt but it is not working. I guess my problem is about adding the event listeners or setting the component id s in the class file. How should i change the code so that it works ? and any good practice advises are welcome. Thank you ... / Code /// / MXML FILE // ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; applicationComplete=init() mx:Script ![CDATA[ import mx.controls.Alert import lostchild.DirectoryBrowser private var lcModel:DirectoryBrowser private function init():void{ lcModel = new DirectoryBrowser() Alert.show(application complete, Flex Debug) } ]] /mx:Script mx:HDividedBox width=100% height=100% mx:Button id=btn width=100 height=100%/ mx:Text id=txt height=100% width=100%/ /mx:HDividedBox /mx:Application / DirectoryBrowser.as placed in the folder lostchild// package lostchild{ import flash.events.MouseEvent import mx.controls.Button import mx.controls.Text import mx.controls.Alert public class DirectoryBrowser{ private var btn:Button = new Button() private var txt:Text = new Text() public function DirectoryBrowser():void{ setStuff() Alert.show(class loaded,class debug) } public function callAlert(evt:MouseEvent):void{ Alert.show(button clicked,debugging event handler) txt.text = working fine } public function setStuff():void{ btn.label = just click! txt.text = i can't get to see this ! btn.addEventListener(MouseEvent.CLICK,callAlert) } } } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com