[flexcoders] Extending ColumnSeries to force labels to always display vertically.
Hi everyone, is it possible to create a class which extends ColumnSeries to force all the labels in my ColumnChart to rotate vertically? I am unable to accomplish this... Any thoughts or ideas??? Thanks everyone.
[flexcoders] Which Class should I extend???
Hey everyone, what class should I extend to manipulate the label inside my ColumnSeries ??? I would like to force the labels in my ColumnSeries to always display vertically and if there isn't enough room inside the column to automatically display outside the column... Thanks guys! -David
[flexcoders] Source could not be found.... when I CTRL-CLICK on a chart Class???
Does anyone know why I get the following error when I CTRL-CLICK on a chart Class??? Source could not be found for mx.charts.series.ColumnSeries in C:\ProgramFiles\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\libs\datavisualization.swc. I'm using Adobe Flex Builder 3.0 (build 3.0.2.214193) ??? Thanks guys... -David
[flexcoders] Forcing a ColumnSeries label to always display vertically?
Hi everyone, how can I force a ColumnSeries label to always display vertically? Thanks. -David
[flexcoders] Sorting columns in a Datagrid don't sort with itemRenderer...
Hi everyone, I'm having a problem with sorting columns in a datagrid when using itemRenderer. Without the itemRenderer, everything works fine but when I use an itemRenderer, the column with the itemRenderer doesn't sort, it simply rotates the rows of that column dgColumn.itemRenderer = new ClassFactory(Smiles); Here's my itemRenderer file Smiles.mxml: ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=setSmileImage() mx:Script ![CDATA[ [Bindable] private var smileImage:String; private function setSmileImage():void { if(data.amount 50) { smileImage= 'smile001.png'; } else if(data.amount = 50) { smileImage= 'smile002.png'; } } ]] /mx:Script mx:Image id=image verticalCenter=0 horizontalCenter=0 source={smileImage}/ /mx:Canvas
[flexcoders] Is it possible to create a 4 axis Plot Chart ???
Hi everyone, is it possible to create a 4 Axis Plot Chart forming a + ? Left to Center: 0 - 50 Center to Right: 50 - 100 Bottom to Center: -100 - 0 Center to Top: 0 - 100 Thanks.
[flexcoders] How can I pass a var to a class???
Hi everyone, is it possible to pass a variable when I call a class??? This is what I'm doing: bar.setStyle('itemRenderer', new ClassFactory(BarColorRenderer)); My class is 'BarColorRenderer' and I would like to also pass it a variable. Is it possible? This is my class: public class BarColorRenderer extends mx.skins.ProgrammaticSkin implements IDataRenderer { public function BarColorRenderer() { } } Thanks everyone.
[flexcoders] verticalAxisRenderers - How can I set my font size of my AxisRenderer Label ???
Hi everyone, I have a BarChart with the following AxisRenderer. I am unable to change the fontsize of my label and my label does not display fully, it is shorten with '...'. Thanks barChart.verticalAxis= axisV; var axisVRenderer:AxisRenderer = new AxisRenderer(); axisVRenderer.placement = 'left'; axisVRenderer.axis = axisV; axisVRenderer.labelRenderer = new ClassFactory(InnerlabelRenderer); barChart.verticalAxisRenderers = [axisVRenderer]; My Class: package { import mx.charts.AxisLabel; import mx.controls.Label; import mx.core.IDataRenderer; public class InnerlabelRenderer extends Label implements IDataRenderer { private var _data:AxisLabel; override public function get data():Object { return _data; } override public function set data(value:Object):void { if(value != null) { this.text = String(value.text); this._data = value as AxisLabel; this.setStyle('color',0x3e3e3e); this.setStyle('fontSize',15); } } } }
[flexcoders] VIEWSTACK question.
Hi everyone, I have a question on viewstacks. I have my viewstack created on MXML with the main canvas also created in MXML. something like: mx:Viewstack id='myViewstack' creationPolicy='all' initialize='getOtherCanvases()' mx:Canvas id='mainCanvas'/ /mx:Viewstack At initialize I call 'getOtherCanvases' function, which adds additional canvases to 'myViewstack' depending on the result I receive from my DB. My question: When I switch viewstack Index, the content of the canvas wasn't previously created and all the children jitter in place the first time I load each index. Shouldn't the creationPolicy='all' create all the children of the viewstack? How can I achieve this? If I create the viewstack and main canvas in actionscript, will it solve my problem? Thanks everyone. :) -David
[flexcoders] How can I receive the smallest value within an Array?
Hi everyone, if I have an array as var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10); Is there a function that will return me the smallest value within that array? Thanks. -David
[flexcoders] I need to set a label...???
Hi everyone, I need to set a label... The actual label is in a ArrayCollection. I can access is like this: parentApplication.MyLabelArray.getItemAt(0).label001 or parentApplication.MyLabelArray.getItemAt(0).label002 or parentApplication.MyLabelArray.getItemAt(0).label003 and so on... Is it possible to access the labels dynamically like this: var labelNames:Array = new Array(label001, label002, label003); for each(var getName:String in labelNames) { var radio00:RadioButton = new RadioButton(); radio00.label = this[parentApplication.MyLabelArray.getItemAt(0).getName; } I can't get this to work... Is there a better way to approach this? Thanks everyone! -David
[flexcoders] How can I create an event that calls a function?
Hi everyone, How can I create an event that calls a function once an ArrayCollection is filled? This is what I'm using at the moment but I would like to avoid setTimeout: public function checkArrayCollection():void { if(myArrayCollection) { } else { setTimeout(checkArrayCollection, 200); } }
[flexcoders] HAPPY EASTER EVERYONE !!!
Just wanted to wish everyone a HAPPY EASTER !!! :)
[flexcoders] include .as file question.
Hi everyone, is it possible to do something similar to this on the MXML file: include this[parentApplication.filename + .as]; I want to dynamically include an .as file depending on what is received from my AMFPHP object... If this is not possible, is there a simpler way to accomplish this? Thanks. -David
[flexcoders] How can I have my class return an ArrayCollection?
Hi everyone, how can I have this following class return me an ArrayCollection whenever I call it [Bindable] public class Services { public var serviceArray:ArrayCollection; public var serviceXML:XML; public function getServices():void { var service:HTTPService= new HTTPService(); service.url= test.php; service.useProxy = false; service.method = POST; service.resultFormat = e4x; service.showBusyCursor = true; service.addEventListener(ResultEvent.RESULT, function (event:ResultEvent):void { serviceArray = new ArrayCollection(); serviceXML = event.result as XML; var ourxml:XML; for each(ourxml in serviceXML.elements()) serviceArray.addItem(ourxml); } ); service.send(); } }
[flexcoders] Is it possible to include a .as file in actionscript within a function?
Hi everyone, is it possible to include an .as file in actionscript within a function but not have the included .as be restricted within the function? private function loaded():void { include axis.as; } Above, the include file will only apply to the function. How can I include a file to the main file or app??? Thanks. -David
[flexcoders] How can I call a function from a class?
Hi everyone, How can I call a function from a class? // MAIN FILE import test.layout; private function callClassFunction():void { test.layout_QT.traceTest(); } // CLASS FILE layout.as package test { public class layout { public function traceTest():void { trace(This is a test.); } } } Thanks.
[flexcoders] How can I add a SeriesInterpolate effect with actionscript to my PieChart?
MXML: mx:SeriesInterpolate id=action duration=1000 minimumElementDuration=200/ ACTIONSCRIPT: var pie:PieSeries = new PieSeries(); pie.setStyle(showDataEffect,action); Does anyone know why the following doesn't animate my chart? Thanks.
[flexcoders] PieChart Legend Label???
Hi everyone, with a ColumnChart, I can set my custom Legend name by setting the displayName attribute in my ColumnSeries. How can I set a custom name to my PieChart Legend Label?? Thanks.
[flexcoders] horizontalAxisRenderer VS horizontalAxisRenderers?
Hi everyone, I have the following script: var columnChart:ColumnChart = new ColumnChart(); var axisVRenderer:AxisRenderer = new AxisRenderer(); axisVRenderer.placement = left; axisVRenderer.axis = int_20; axisVRenderer.labelFunction = axisPercent; ***columnChart.verticalAxisRenderers = axisVRenderer; I don't understand why it's generating the following error: *** 1067: Implicit coercion of a value of type mx.charts:AxisRenderer to an unrelated type Array. If I replace the verticalAxisRenderers by verticalAxisRenderer I receive the following warning: 3606: 'verticalAxisRenderer' has been deprecated. Please use 'CartesianChart.verticalAxisRenderers'. Should I use verticalAxisRenderer and ignore the warning? Thanks. -David
[flexcoders] SeriesInterpolate in actionscript ColumnChart?
Hi everyone, I'm trying to set a SeriesInterpolate for my ColumnSeries, this is my code: var columnChart:ColumnChart = new ColumnChart(); (...) var action:SeriesInterpolate= new SeriesInterpolate(); action.duration = 1000; action.minimumElementDuration = 200; action.elementOffset= 0; var myColumnSeries:Array= new Array(); var col:ColumnSeries= new ColumnSeries(); col.yField = data; col.xField = title; col.setStyle(showDataEffect,action); myColumnSeries.push(col); columnChart.series = myColumnSeries; If I write it out in MXML, I can get it to work, but not in actionscript. What am I doing wrong? Thanks.
[flexcoders] HOW can I convert a string into a DataGridColumn ?
Hi everyone, I have the folowing script that adds the % symbol: public function dataGridPercent(item:Object, column:DataGridColumn):String { var str:String = item[column.dataField]; return str + %; } This works fine but it breaks my export to excel script. I'm thinking because the value is now a string. How can I keep the value as a DataGridColumn but add the % symbol ? The following doesn't work: public function dataGridPercent(item:Object, column:DataGridColumn):DataGridColumn { var str:String = item[column.dataField]; return DataGridColumn(str + ); } Thanks. -David
[flexcoders] How can I format the text in my custom labelFunction?
Hi everyone, how can I format the text in my custom labelFunction (bold, center, color...) CategoryAxis: labelFunction=test_labelFunc. private function test_labelFunc(item:String,previousItem:Object,axis:CategoryAxis,labelItem:XML):String { var labelArray:Array = item.split('?'); return labelArray[0] + '\n' + labelArray[1] + '\n' + labelArray[2]; } I would like my return text to be centered and my labelArray[0] to be bold. Are there any tutorials? Thanks.
[flexcoders] DYNAMIC actionscript child layout.
Hi everyone, when I create my layout with mxml components, my layout is dynamic. If I resize my browser window, my components are also resized. How can I achieve this in actionscript using addChild??? var Layout:Canvas = new Canvas(); graphLayout.width=testlayout.width/2; graphLayout.height=testlayout.width/2; layout_graphs.addChild(graphLayout); testlayout is my vbox that will be parent to the canvas. Thanks.
[flexcoders] DYNAMIC LINKBUTTONS styleNames.
I have a series of 3 linkButtons. I am able to switch the styleName of a linkButton when I click on it as follows: [Bindable] private var linkButton:String = 'linkButton'; [Bindable] private var linkButtonOff:String = 'linkButtonOff'; mx:LinkButton id=test001 label=001 styleName={linkButton} buttonMode=true click=setType(event)/ mx:LinkButton id=test002 label=002 styleName={linkButton} buttonMode=true click=setType(event)/ mx:LinkButton id=test003 label=003 styleName={linkButton} buttonMode=true click=setType(event)/ private function setType(result:Event):void { result.currentTarget.styleName = linkButtonOff; } How can I automatically reset all the other linkButtons styleNames to {linkButton} when a linkButton is clicked? Thank you.
[flexcoders] ArrayCollection DataProvider question.
I loaded the following xml as an ArrayCollection. data result id=1 datetoday/date yes13154/yes no654321/no /result result id=1 dateyesterday/date yes21354/yes no5468432/no /result result id=2 datetoday/date yes2665/yes no4256/no /result result id=2 dateyesterday/date yes7425/yes no7542/no /result /data How can I use this as a dataprovider but only using the values in result id=1 and not result id=2? My arraycollection var is Arraydays. I tried {Arraydays.(@id=='2')} but it gave me an error: Error #1123: Filter operator... Thanks.
[flexcoders] ACCORDION - How can I switch my cursor to a pointer?
Hi everyone, how can I switch my cursor to a hand pointer when it goes over the accordion header? Thanks. -David.
[flexcoders] XML - What var type can I use for my XML nodes?
Hi everyone, I have the following: mx:XML id=testID format=e4x source=xml/test.xml/ mx:Text text={testID.result.(@now=='today').date}/ What var type can I use for testID.result.(@now=='today') to simply my text string? I would like to have the following: [Bindable] public var xmlvar:String = testID.result.(@now=='today'); mx:Text text={xmlvar.date}/ Thanks. David
[flexcoders] RERENDER - Is there a way to force a canvas to re-render/refresh?
Hi everyone, is there a way to force a canvas to rerender/refresh? Thanks. David
[flexcoders] PIE - Animated pie chart still displays old data when updated???
Hi everyone, I created an animated pie chart that is divided into 3 segments. mx:PieChart dataProvider= {test} mx:series mx:PieSeries labelPosition= outside nameField=name field=field mx:showDataEffect mx:SeriesInterpola te/ /mx:showDataEffect /mx:PieSeries /mx:series /mx:PieChart The pie animates perfectly but when new data comes in, if the new data has only data for 2 out of the 3 segments, it will animate correctly and display the sections correctly but the old data from the 3rd section remains as if it's cached somehow. If I minimize IE and then restore it, the old data disappears as if the page refreshes... Is there a way to automatically refresh the page still animating the pie charts. If I remove the animation I do not have this problem. Thanks. -David
[flexcoders] Sailorsea21 - Animated pie chart still displays old data when updated???
Hi everyone, I created an animated pie chart that is divided into 3 segments. mx:PieChart dataProvider={test} mx:series mx:PieSeries labelPosition=outside nameField=name field=field mx:showDataEffect mx:SeriesInterpolate/ /mx:showDataEffect /mx:PieSeries /mx:series /mx:PieChart The pie animates perfectly but when new data comes in, if the new data has only data for 2 out of the 3 segments, it will animate correctly and display the sections correctly but the old data from the 3rd section remains as if it's cached somehow. If I minimize IE and then restore it, the old data disappears as if the page refreshes... Is there a way to automatically refresh the page still animating the pie charts. If I remove the animation I do not have this problem. Thanks. -David
[flexcoders] How can I display the ID of my HTTPService in my FaultEvent?
Hi everyone, how can I display the ID of my HTTPService in my FaultEvent? The following script doesn't work and I can't understand why. private function get_fault(event:FaultEvent):void { mx.controls.Alert.show(event.currentTarget.id + ., event.fault.faultString + :); } event.currentTarget works but I would like to display the ID. Thanks. David
[flexcoders] Copy multiple datagrids to the clipboard...
Hi everyone, I have a script that copies data from a datagrid to a clipboard and I can then paste it in Excel. How can I modify this script if I would like to copy data from 2 or more datagrids??? Here's the script: mx:Button label=Copy It click=copyDataGrid(thedataGrid)/ public function copy(dg:DataGrid):void { var str:String = new String(); var rows:Number = 0; str += dg.name; str += \n; for(var i:int = 0;idg.columns.length;i++) { str+= dg.columns[i].headerText + \t; } str += \n; for(var j:int =0;jdg.dataProvider.length;j++) { for(var k:int=0; k dg.columns.length; k++) { if(dg.dataProvider.getItemAt(j) != undefined dg.dataProvider.getItemAt(j) != null) { if(dg.columns[k].labelFunction != undefined dg.columns[k].labelFunction != null) { str += \ + dg.columns [k].labelFunction(dg.dataProvider.getItemAt(j),dg.columns[k]) + \ + \t; } else { var data:String = new String(); if( dg.dataProvider.getItemAt (j)[dg.columns[k].dataField] == null) { data = ; } else { data = dg.dataProvider.getItemAt(j)[dg.columns[k].dataField].toString(); } data = data.replace(//g, ); str += \ + data + \ + \t; } } } rows++; str += \n; } System.setClipboard(str); }
[flexcoders] Flex 3 - Export to Microsoft Excel?
Hi everyone, is it possible to export to Excel? If I have a chart or a datagrid, is it possible to export it to Microsoft Excel? Thanks. -David.
[flexcoders] Is there a way to include MXML inside another MXML like PHP include ?
Is there a way to include MXML inside another MXML like PHP include ? Thanks.
[flexcoders] Re: Is there a way to include MXML inside another MXML like PHP include ?
How can I access values from the component? I tried the following but it didn't work: My component colors.mxml has the following: mx:SolidColor id=test color=#00/ My main app has this: ... xmlns:custom=comp.* ... custom:colors/ ...fill={test} but it doesn't work. I'm trying to clean out my main MXML code in seperate files... Thanks. --- In flexcoders@yahoogroups.com, SAAGAR SHETTY [EMAIL PROTECTED] wrote: Yes there is. You can create a mxml component and use that. The only difference is that this mxml will not have mx:Application tag in it. Instead it will start with a container like panel or vbox etc. To include this in your application all you have to do is include its namespace and use the name of the mxml file in which you have created your component. If you are using flex builder it will take care of name space declaration. Regards, Saagar Shetty www.xoriant.com From: sailorsea21 [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, 28 November, 2008 7:56:30 PM Subject: [flexcoders] Is there a way to include MXML inside another MXML like PHP include ? Is there a way to include MXML inside another MXML like PHP include ? Thanks. Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
[flexcoders] sailorsea21 - is there an include command in Flex that acts likes PHP include?
Hi everyone, I would like to clean up my main mxml file since it's getting farely big. Is there an include command that will allow me to split up my MXML code in several MXML files. Something like the PHP INCLUDE command? Thanks.
[flexcoders] How can I force the labels on my ColumSeries to remain vertical?
Hi everyone, How can I force the labels on my ColumSeries to always remain vertical? At the moment, if the labels are short enough, they will remain horizontal. This is what I have in my code: mx:ColumnChart showLabelVertically=true ... mx:ColumnSeries labelPosition=outside ... This is what I have in my CSS: @font-face { src: local(Arial); font-family: EmbeddedArial; } ColumnSeries { font-family: EmbeddedArial; } Thanks.
[flexcoders] Sailorsea21 - Can I use a nested XML node as a dataprovider for my pie chart?
Hi everyone, can I use a nested XML node as a dataprovider for my pie chart? I have the following XML file: ?xml version='1.0' encoding='UTF- 8' ? data result test001464 /test001 test002425 /test002 test00326 /test003 test00463 /test004 test0054573 /test005 subresult answerYes /answer answers90 /answers /subresult subresult answerNo/ answer answers10 /answers /subresult /result result test001254 /test001 test002346 /test002 test00346 /test003 test00463 /test004 test005453 /test005 /result /data I would like to have a pie chart based on the subresult. Thanks.
[flexcoders] Can I use a nested XML element as a dataprovider for my pie chart?
Hi everyone, can I use a nested XML element as a dataprovider for my pie chart? I have the following XML file: ?xml version='1.0' encoding='UTF-8' ? data result test001464/test001 test002425/test002 test00326/test003 test00463/test004 test0054573/test005 subresult answerYes/answer answers90/answers /subresult subresult answerNo/answer answers10/answers /subresult /result result test001254/test001 test002346/test002 test00346/test003 test00463/test004 test005453/test005 /result /data I would like to have a pie chart based on the subresult. Thanks.
[flexcoders] Re: How can I place my labels in my column chart vertically?
Hi everyone, I'm actually talking about the labels for my ColumnSeries. I got something visually working but it doesn't always display the correct data. The data in my Column DataTips are precise but the data from my ColumnSeries Labels aren't always precise This is what I did: On my mx:ColumnChart... I added showLabelVertically=true. On my mx:ColumnSeries... I added labelPosition=outside labelField=mylabelfield. And on my CSS file I added: @font-face { src: local(Arial); font-family: EmbeddedArial; } ColumnSeries { font-family: EmbeddedArial; } My ColumnSeries Labels are now Vertical but the data isn't always the right data??? I really need to solve this... Thanks :) --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Brendan Meutzner bmeutzner@ wrote: If you're talking about the horizontalAxis labels then.. 1) Embed a font, and specify that font in your label style 2) set rotation on horizontalAxisRenderer In order to rotate the labels, an embedded font must be used. You can also rotate text objects that are not using embedded fots by setting the blendMode to layer. HTH; Amy
[flexcoders] I can't get my ColumnSeries labels to display the correct data...
Hey everyone, I can't get my ColumnSeries labels to display the correct data... My DataTips always display the correct data but some labels in my ColumnSeries are (at times or always) wrong... Can anyone help me out with this? Thanks. -David
[flexcoders] How can I place my labels in my column chart vertically?
Hi everyone, how can I place my label on my column chart series vertically? Thanks! -David
[flexcoders] I set my column labels vertically but now my vertical axis labels disappeared?
I was able to set my column labels vertically but now my vertical axis labels disappeared... How can I fix this issue? Thanks.
[flexcoders] Why aren't my .as files included when I build my project?
Hi everyone, why are my .as files being excluded when I build my project? Thanks.
[flexcoders] Re: Why aren't my .as files included when I build my project?
I'm working with Flex Buildre 3. All my .as files are in a folder called as. I link to them as follows: mx:Script source=as/myfile.as/ Here is the file: ?xml version=1.0 encoding=UTF-8? actionScriptProperties mainApplicationPath=uiscores.mxml version=3 compiler additionalCompilerArguments=-locale en_US copyDependentFiles=true enableModuleDebug=true generateAccessible=false htmlExpressInstall=true htmlGenerate=true htmlHistoryManagement=true htmlPlayerVersion=9.0.124 htmlPlayerVersionCheck=true outputFolderLocation=C:/wamp/www/UIScores/uiscores008/uiscores008- debug outputFolderPath=bin-debug sourceFolderPath=src strict=true useApolloConfig=false verifyDigests=true warn=true compilerSourcePath/ libraryPath defaultLinkType=1 libraryPathEntry kind=4 path=/ libraryPathEntry kind=1 linkType=1 path=libs/ /libraryPath sourceAttachmentPath/ /compiler applications application path=uiscores.mxml/ /applications modules module application=src/uiscores.mxml destPath=module_admin.swf optimize=true sourcePath=src/module_admin.mxml/ module application=src/uiscores.mxml destPath=module_refresh_rate.swf optimize=true sourcePath=src/module_refresh_rate.mxml/ module application=src/uiscores.mxml destPath=module_videotron_qt_res_tous.swf optimize=true sourcePath=src/module_videotron_qt_res_tous.mxml/ module application=src/uiscores.mxml destPath=module_close.swf optimize=true sourcePath=src/module_close.mxml/ module application=src/uiscores.mxml destPath=module_render_print_close.swf optimize=true sourcePath=src/module_render_print_close.mxml/ /modules buildCSSFiles/ /actionScriptProperties Thank you very much. -David --- In flexcoders@yahoogroups.com, Maciek Sakrejda [EMAIL PROTECTED] wrote: Because your project is not configured correctly. Hard to say more without details. Are you building with eclipse? Can you post your .actionScriptProperties file (found in the root of your project directory), and describe your project layout? -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com
[flexcoders] Re: Why aren't my .as files included when I build my project?
Hi Tracy, I innitially had all my actionscript embedded in my mxml. I decided to clean up the file and put the actionscript in an .as file in a folder called as. After I build my application, the as folder and the .as files are not copied in my bin-debug folder therefore when I run the app, it doesn't work. I call my file with the following command: mx:Script source=as/myfile.as/ My myfile.as has the following structure: // ActionScript file import mx.controls.Alert; private function login_FaultHandler():void { mx.controls.Alert.show(Could not connect...); } (...) Thank you. --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Exactly what do you mean by excluded? What problem are you having? And you understand that the Script source= syntax is an *include* functionality? It essentially physically copies the code verbatim into the file that declares it, before compilation. It is identical to putting the code in a script block. It is not for classes. Tracy
[flexcoders] Re: Why aren't my .as files included when I build my project?
Thanks Tracy, the problem was not my .as file... For some reason, ie was not showing me any errors, the app was simply not working so I figured that it was not loading my .as files... I tested in firefox and received an error. I was able to fix the bug. Thanks for the help! :) --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Ah, they should *not* be copied into the bin folder. Only files required to run the application should be in (copied into) the bin folder. Included files and class files are all compiled into the resulting swf file. If the app does not work it is not because of this. When you say it doesn't work., what do you mean? Tracy
[flexcoders] Memory Leaks... Cumulative Memory and Memory.
Hi everyone, I think I'm having some issues with memory leaks. The memory of my Cumulative Memory and of my Memory keep increasing. When I unload modules, the memory doesn't drop and if I reload the modules, the memory keeps climbing... When I use the import command (ie:import mx.controls.Alert;), do I need to unload the mx.controls.Alert when I unload my module? If so, how do I do this? If not, why does my memory keep climbing when I unload a module and reload it? Shouldn't it drop and then climb back? Thanks. -David
[flexcoders] How can I add a Progress bar to show the render to JPG progress?
Hi everyone, I have a button which renders my component to JPG. How can I attach a progress bar to show the progress of the rendering? mx:Button label=render click=renderasJPEG ()/ public function renderasJPEG( ):void { convertToImage( component001, new JPEGEncoder( 100)); } private function convertToImage( object:IUICompon ent, encoder:IImageEncod er):void { var base64string: String = ImageSnapshot. encodeImageAsBas e64( ImageSnapshot. captureImage( object, 72, encoder)); var variables:URLVariab les = new URLVariables( ); variables.encoded = base64string; variables.type = jpeg; var request:URLRequest = new URLRequest( script_saveasima ge.php); request.method = POST; request.data = variables; navigateToURL( request, _blank); } Thanks.
[flexcoders] How do I add a Progress bar to show the render to JPG progress?
Hi everyone, I have a button which renders my component to JPG. How can I attach a progress bar to show the progress of the rendering? mx:Button label=render click=renderasJPEG()/ public function renderasJPEG():void { convertToImage(component001, new JPEGEncoder(100)); } private function convertToImage(object:IUIComponent, encoder:IImageEncoder):void { var base64string:String = ImageSnapshot.encodeImageAsBase64( ImageSnapshot.captureImage(object, 72, encoder)); var variables:URLVariables = new URLVariables(); variables.encoded = base64string; variables.type = jpeg; var request:URLRequest = new URLRequest(script_saveasimage.php); request.method = POST; request.data = variables; navigateToURL(request, _blank); } Thanks.
[flexcoders] How can I get my CircleItemRenderer to work with SeriesInterpolate?
Hi everyone, how can I get my CircleItemRenderer to work with my interpolate on a LineSeries??? If I remove the Interpolate, the ItemRenderer works fine but when I add the Interpolate, the itemRenderer disapears??? Do I need to import anything to make this work??? (import mx.charts...) This is my script. mx:SeriesInterpolate id=seriesInterpolate duration=1500/ (...) mx:series mx:ColumnSeries showDataEffect={seriesInterpolate} yField=TOTAL displayName=TOTAL/ mx:LineSeries showDataEffect={seriesInterpolate} temRenderer=mx.charts.renderers.CircleItemRenderer yField=TOTAL2 displayName=TOTAL (2)/ /mx:series Thanks.
[flexcoders] If I have 2 panels, each with their own print buttons, can I have one function?
Hello everyone, if I have 2 panels, each with their print buttons, can I simply have 1 function for both buttons? This way, if I have 15 panels, I can only use one function for all the print buttons instead of 15... This is my simplified script: private function print(event:MouseEvent):void { var Printbutton:FlexPrintJob = new FlexPrintJob(); var printConfirmed:Boolean = Printbutton.start(); if(printConfirmed) { Printbutton.addObject(event.Target.???); Printbutton.send(); } } mx:Panel id=PanelTest001 /mx:Panel mx:Button label=print click=print(event)/ mx:Panel id=PanelTest002/ /mx:Panel mx:Button label=print click=print(event)/ Thank you very much.
[flexcoders] Re: If I have 2 panels, each with their own print buttons, can I have one function?
Hi Gregor, are there any examples? How can I go about it? Thanks again. --- In flexcoders@yahoogroups.com, Gregor Kiddie [EMAIL PROTECTED] wrote: yes Gregor Kiddie Senior Developer INPS Tel: 01382 564343 Registered address: The Bread Factory, 1a Broughton Street, London SW8 3QJ Registered Number: 1788577 Registered in the UK Visit our Internet Web site at www.inps.co.uk blocked::http://www.inps.co.uk/ The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contact [EMAIL PROTECTED]
[flexcoders] Re: If I have 2 panels, each with their own print buttons, can I have one function?
Printbutton. addObject(event.Target. ???); How do I target the panels? I would like each button to target their panel using the same function... Thanks. private function print(event: MouseEvent) :void { var Printbutton: FlexPrintJob = new FlexPrintJob( ); var printConfirmed: Boolean = Printbutton. start(); if(printConfirmed) { Printbutton. addObject(event.Target. ???); Printbutton. send(); } } mx:Panel id=PanelTest001 /mx:Panel mx:Button label=print click=print( event)/ mx:Panel id=PanelTest002 / /mx:Panel mx:Button label=print click=print( event)/ --- In flexcoders@yahoogroups.com, Gregor Kiddie [EMAIL PROTECTED] wrote: The code you wrote was pretty much spot on... are there any other requirements you didn't mention? Gregor Kiddie Senior Developer INPS Tel: 01382 564343 Registered address: The Bread Factory, 1a Broughton Street, London SW8 3QJ Registered Number: 1788577 Registered in the UK Visit our Internet Web site at www.inps.co.uk blocked::http://www.inps.co.uk/ The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contact [EMAIL PROTECTED]
[flexcoders] Re: If I have 2 panels, each with their own print buttons, can I have one function?
This worked! Thanks again :) --- In flexcoders@yahoogroups.com, Gregor Kiddie [EMAIL PROTECTED] wrote: Something like... ((Its been a while since I looked at the printing stuff, but this should give you a head start)) private function print(comp: UIComponent) :void { var Printbutton: FlexPrintJob = new FlexPrintJob( ); var printConfirmed: Boolean = Printbutton. start(); if(printConfirmed) { Printbutton. addObject(comp); Printbutton. send(); } } mx:Panel id=PanelTest001 /mx:Panel mx:Button label=print click=print(PanelTest001)/ mx:Panel id=PanelTest002 / /mx:Panel mx:Button label=print click=print(PanelTest002)/ Gk. Gregor Kiddie Senior Developer INPS Tel: 01382 564343 Registered address: The Bread Factory, 1a Broughton Street, London SW8 3QJ Registered Number: 1788577 Registered in the UK Visit our Internet Web site at www.inps.co.uk blocked::http://www.inps.co.uk/ The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contact [EMAIL PROTECTED]
[flexcoders] Why does seriesInterpolate disables my CircleItemRenderer in my LineSeries...?
Hi everyone, I have a ColumnChart with 2 ColumnSeries and 2 LineSeries. My LineSeries look like this: mx:LineSeries itemRenderer=mx.charts.renderers.CircleItemRenderer yField=test/ Everything works ok until I add an Interpolate effect to my 4 series. My LineSeries now look like this: mx:SeriesInterpolate id=seriesInterpolate duration=2000/ mx:LineSeries showDataEffect={seriesInterpolate} itemRenderer=mx.charts.renderers.CircleItemRenderer yField=test/ Now, the interpolate effect works great on all my series BUT my ItemRenderers have disapeared Anyone has any idea why this happens??? Thanks. -David
[flexcoders] How can I directly access the yField data?
Is there a way to simplify the script below without using the if / else if? How can I directly access the yField data? If I type: value = event.item.yField; I get nothing insead of the data in my xml... private function myDataTipFunction(event:HitData):String { var value:String; if (ColumnSeries(event.element).yField == test001) { value = event.item.test001; } else if (ColumnSeries(event.element).yField == test002) { value = event.item.test002; } else if (ColumnSeries(event.element).yField == test003) { value = event.item.test003; } return value; } Thank you. -David
[flexcoders] sailorsea21 - showDataEffect disables my itemRenderer on my LineSeries...
Hi everyone, when I add a showDataEffect on my LineSeries, my itemRenderer on my LineSeries is no longer visible. Here's my code: mx:SeriesInterpolate id=seriesInterpolate duration=1000 / mx:LineSeries showDataEffect={seriesInterpolate} itemRenderer=mx.charts.renderers.BoxItemRenderer verticalAxis={percent} id=test yField=TEST/ Thanks. -David
[flexcoders] sailorsea21 - How can I replace certain values in my array with my HTTPService?
Hi everyone, I have 2 HTTPServices that populate my array: [Bindable] public var ArrayStats:ArrayCollection = new ArrayCollection; [Bindable] private var XMLStats:XML; private function get(event:ResultEvent):void { XMLStats = event.result as XML; for each(var ourxml:XML in XMLStats.elements() ) ArrayStats.addItem (ourxml); } mx:HTTPService url=test001.php useProxy=false method=POST id=test001 resultFormat=e4x result=get(event); test002.send()/ mx:HTTPService url=test002.php useProxy=false method=POST id=test002 resultFormat=e4x result=get(event)/ My array is displayed as a Column Chart. How can I simply resend my first HTTPService and update the info that was previously set in the array. I tried an option to remove all the data in my array and resend both my HTTPService. It works but I would rather just update the first HTTPService... I do not want my full graph to be refreshed. I would like to have the columns from the 1st HTTPService updated. Thanks. -David
[flexcoders] Re: sailorsea21 - How can I modify the value in my ColumnSeries datatip.
Thanks everyone! Works great :) -David --- In flexcoders@yahoogroups.com, EddieBerman [EMAIL PROTECTED] wrote: Here you go... private function myDataTipFunction( e:HitData ):String { var obj:Object = e.chartItem; if (e.chartItem is ColumnSeriesItem) { ...your columnSeries code here } else { ...your lineSeries code here } -Eddie --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, sailorsea21 sailorsea21@ wrote: Hi Amy, My graph is a multiple series (Column and Line). I successfully modified the column series datatip but my line series data tip is now giving me an error: Type Coercion failed: cannot convert mx.charts.series::[EMAIL PROTECTED] to mx.charts.series.ColumnSeries. How can I have another function for my LineSeries data tip? This is my script: public function myDataTipFunction(e:HitData):String { var columnValue:String; var value:String; var yF:String = ColumnSeries(e.element).yField; if (yF == importations) { columnValue = ColumnSeries(e.element).displayName + \n + e.item.period + \n + numberFormatter.format (e.item.importations); value = columnValue; } else if (yF == finalises) { columnValue = ColumnSeries(e.element).displayName + \n + e.item.period + \n + numberFormatter.format(e.item.finalises); value = columnValue; } return value; } There should be a more generic type that both series types inherit from that you could use. If not, try casting it both ways and having alternate paths for each. HTH; Amy
[flexcoders] sailorsea21 - How can I modify the value in my ColumnSeries datatip.
Hi everyone, I have a multiple series graph: ColumnSeries and LineSeries. How can I modify the value displayed in my ColumnSeries datatip? The value is a numeric value like 20465. I would like to apply a numberFormatter to the value displayed in the ColumnSeries datatip without affecting the LineSeries datatip. Is this possible? This is my code: mx:Script ![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; import mx.printing.FlexPrintJob; import mx.graphics.codec.IImageEncoder; import mx.graphics.codec.JPEGEncoder; import mx.graphics.ImageSnapshot; import mx.core.IUIComponent; import mx.formatters.NumberFormatter; import mx.charts.chartClasses.IAxisRenderer; [Bindable] public var ArrayImportationLive:ArrayCollection = new ArrayCollection; [Bindable] private var XMLImportationLive:XML; private function get_importationLive(event:ResultEvent):void { ArrayImportationLive.removeAll(); XMLImportationLive = event.result as XML; for each(var ourxml:XML in XMLImportationLive.elements() ) ArrayImportationLive.addItem(ourxml); } private function axisSymbol (axis:IAxisRenderer,percent_value:String):String { return percent_value + %; } private function axisFormatThousand (axis:IAxisRenderer,format:String):String { return numberFormatter.format(format); } ]] /mx:Script mx:NumberFormatter id=numberFormatter/ mx:LinearAxis id=int_5000 interval=5000/ mx:LinearAxis id=percent interval=10 maximum=100/ mx:HTTPService url=xml.php useProxy=false method=POST id=importationLive resultFormat=e4x result=get_importationLive (event)/ mx:ColumnChart id=S_Res type=overlaid dataProvider={Array} showDataTips=true mx:horizontalAxis mx:CategoryAxis id=H_ArrayImportationLive dataProvider={Array} categoryField=period/ /mx:horizontalAxis mx:horizontalAxisRenderers mx:AxisRenderer placement=bottom axis={H_ArrayImportationLive}/ /mx:horizontalAxisRenderers mx:verticalAxisRenderers mx:AxisRenderer placement=left axis={int_5000} labelFunction=axisFormatThousand/ mx:AxisRenderer placement=right axis={percent} labelFunction=axisSymbol/ /mx:verticalAxisRenderers mx:series mx:ColumnSeries verticalAxis={int_5000} yField=in displayName=In/ mx:ColumnSeries verticalAxis={int_5000} yField=out displayName=Out/ mx:LineSeries verticalAxis={percent} yField=rate displayName=Rate/ mx:LineSeries verticalAxis={percent} yField=avg displayName=Average/ /mx:series /mx:ColumnChart mx:Legend dataProvider={S_Res} direction=horizontal/ This is my XML: ?xml version='1.0' encoding='UTF-8' ? data result; periodToday/period in45632/in out32654/out rate78%/rate; avg66%/avg; /result; Thank you -David.
[flexcoders] sailorsea - Several buttons targeting different panels with 1 function?
Hello everyone, I have several panels. They each have a print and a save button. Is it possible to have only one function to target the panel from the buttons? Here's my code: private function print(event:MouseEvent):void { var Printbutton:FlexPrintJob = new FlexPrintJob(); var printConfirmed:Boolean = Printbutton.start(); if(printConfirmed) { Printbutton.addObject((event.target.id)+_b); Printbutton.send(); } } private function save(event:MouseEvent):void { convertToImage(((event.target.id)+P_b), new JPEGEncoder(100)); } mx:Panel id=Panel001_SP_b/ mx:Button id=Panel001_S label=print click=print(event)/ mx:Button id=Panel001_SP label=save click=save(event)/ mx:Panel id=Panel002_SP_b/ mx:Button id=Panel002_S label=print click=print(event)/ mx:Button id=Panel002_SP label=save click=save(event)/ mx:Panel id=Panel003_SP_b/ mx:Button id=Panel003_S label=print click=print(event)/ mx:Button id=Panel003_SP label=save click=save(event)/ Thanks! -David
[flexcoders] Re: sailorsea21 - How can I modify the value in my ColumnSeries datatip.
Hi Amy, My graph is a multiple series (Column and Line). I successfully modified the column series datatip but my line series data tip is now giving me an error: Type Coercion failed: cannot convert mx.charts.series::[EMAIL PROTECTED] to mx.charts.series.ColumnSeries. How can I have another function for my LineSeries data tip? This is my script: public function myDataTipFunction(e:HitData):String { var columnValue:String; var value:String; var yF:String = ColumnSeries(e.element).yField; if (yF == importations) { columnValue = ColumnSeries(e.element).displayName + \n + e.item.period + \n + numberFormatter.format(e.item.importations); value = columnValue; } else if (yF == finalises) { columnValue = ColumnSeries(e.element).displayName + \n + e.item.period + \n + numberFormatter.format(e.item.finalises); value = columnValue; } return value; } Thank you. -David --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, sailorsea21 sailorsea21@ wrote: Hi everyone, I have a multiple series graph: ColumnSeries and LineSeries. How can I modify the value displayed in my ColumnSeries datatip? The value is a numeric value like 20465. I would like to apply a numberFormatter to the value displayed in the ColumnSeries datatip without affecting the LineSeries datatip. Is this possible? http://livedocs.adobe.com/flex/3/html/help.html? content=charts_displayingdata_08.html
[flexcoders] sailorsea21 - How can I add the % symbol on my vertical axis in my chart?
Hello everyone, How can I add the % symbol on my vertical axis after my value? mx:LinearAxis id=percent interval=10/ mx:LineSeries verticalAxis={percent} yField=test showDataEffect=interpolate/ Thanks -David
[flexcoders] ss - Is it possible to display all my series in my chart but not in my legend?
Hi everyone, is it possible to display all my series in my chart but not in my legend? Thanks.
[flexcoders] sailorsea21 - How to stop a timer that is in a private function?
Hi everyone, I have the following timer: private function initTimer():void { var myTimer:Timer = new Timer(3); myTimer.addEventListener(TimerEvent.TIMER, updateData); myTimer.start(); } How can I stop the following timer? Can it be stopped using another function? Thanks. -David
[flexcoders] Re: sailorsea21 - How to stop a timer that is in a private function?
Is the reference global? My reference myTimer cannot be access from another function... Can you clarify? Thanks. --- In flexcoders@yahoogroups.com, Gregor Kiddie [EMAIL PROTECTED] wrote: The target property in the TimerEvent when it fires contains a reference to the Timer Object that you can use to stop the Timer. Gk. Gregor Kiddie Senior Developer INPS Tel: 01382 564343 Registered address: The Bread Factory, 1a Broughton Street, London SW8 3QJ Registered Number: 1788577 Registered in the UK Visit our Internet Web site at www.inps.co.uk blocked::http://www.inps.co.uk/ The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contact [EMAIL PROTECTED]
[flexcoders] How can I stop my HTTPService?
Hi everyone, I have an HTTPService that I load in a module. When I unload the module the HTTPService keeps working... This is my HTTPService: mx:HTTPService url=test.php method=POST id=rate useProxy=false result=getRate(event) fault=FaultHandler() showBusyCursor=true/ I start my HTTPService with the following command: rate.send(); What command can I use to kill the HTTPService when I unload my module? Thanks.
[flexcoders] Re: How can I stop my HTTPService?
It doesn't seem to work... When I try to reload my module and re- establish my HTTPService, it never connects... ? The cursor is always busy... Thanks. --- In flexcoders@yahoogroups.com, florian.salihovic [EMAIL PROTECTED] wrote: How about the cancel method of HTTPService? Best regards.
[flexcoders] sailorsea21 - Is it possible to use a value from a variable as a Timer value?
Hey everyone, I have a value of 3 stored in a MySQL database. I call this value and import it in flex via HTTPService (PHP XML): mx:HTTPService url=value.php method=POST id=rate useProxy=false result=getRate(event)/ I now have a timer: var myTimer:Timer = new Timer(3); Can I replace the hard-coded value of 3 with the value that is stored in my database? This is my script: [Bindable] public var valuesMilliseconds:int; private function getRate(event:ResultEvent):void { valuesMilliseconds = event.result.database.row.Refresh_Rate; } I tried the following but it didn't work: var myTimer:Timer = new Timer(valuesMilliseconds); Thanks. -David
[flexcoders] Re: sailorsea21 - Is it possible to use a value from a variable as a Timer value?
Got it working thanks! My problem was that the timer was being created before the getRate function. Thanks again :) --- In flexcoders@yahoogroups.com, Mike Chabot [EMAIL PROTECTED] wrote: You can definitely use a variable there. You might want to step through the code to make sure that the variable is getting populated with the correct value and that the timer is being created after the getRate function completes. -Mike Chabot On Mon, Oct 27, 2008 at 4:11 PM, sailorsea21 [EMAIL PROTECTED] wrote: Hey everyone, I have a value of 3 stored in a MySQL database. I call this value and import it in flex via HTTPService (PHP XML): mx:HTTPService url=value.php method=POST id=rate useProxy=false result=getRate(event)/ I now have a timer: var myTimer:Timer = new Timer(3); Can I replace the hard-coded value of 3 with the value that is stored in my database? This is my script: [Bindable] public var valuesMilliseconds:int; private function getRate(event:ResultEvent):void { valuesMilliseconds = event.result.database.row.Refresh_Rate; } I tried the following but it didn't work: var myTimer:Timer = new Timer(valuesMilliseconds); Thanks. -David
[flexcoders] Re: sailorsea21 - Does anyone know why this code works with Firefox but not with IE?
This worked! Thank you very much. :) -David --- In flexcoders@yahoogroups.com, SAAGAR SHETTY [EMAIL PROTECTED] wrote: Hi, Since you are using private var HTTPService_ url:String = company.php? ForceIEReload ms= + new Date().getTime( ); at the start of your code, it is being initialized only once. This means that your string is a constant throughout the program. That is why IE caches the data. Instead try the following private var HTTPService_ url:String = company.php? ForceIEReload ; mx:HTTPService url={HTTPService_ url} method=POST id=data resultFormat= e4x result=xmlResultHandler(event) ; fault=xmlFaultHand ler(event) ; mx:request rndParam{Math.round(Math.random()*1000)}/rndParam /mx:request /mx:HTTPService The text in bold is the additional code you need to add. Hope this helps Thanks, Saagar Shetty.
[flexcoders] sailorsea21 - Does anyone know why this code works with Firefox but not with IE?
Hey everyone, I populate my chart from a MySQL database. My php script retrieves the data and then converts it into XML for my flex chart. I needed to have the chart refreshed every 30sec without refreshing the entire page. I got a script working perfectly for Firefox. Every 30sec the chart updates but in Internet explorer, it will only update every hour or so... Is there a fix or is this a know IE bug? This is the script: mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; [Bindable] private var myxmldata:ArrayCollection = new ArrayCollection; [Bindable] private var xmlFeed:XML; private function xmlResultHandler(event:ResultEvent):void { myxmldata.removeAll() ; xmlFeed = event.result as XML; for each(var ourxml:XML in xmlFeed.elements() ) myxmldata.addItem (ourxml); } private function xmlFaultHandler(event:FaultEvent):void { var faultMessage:String = Could not connect with XML file; Alert.show(faultMessage, Error opening file); } public function initTimer():void { var myTimer:Timer = new Timer(3); myTimer.addEventListener(TimerEvent.TIMER, updateData); myTimer.start(); } private function updateData(event:TimerEvent):void { data.send(); } ]] /mx:Script Thanks everyone! -David
[flexcoders] Re: sailorsea21 - Does anyone know why this code works with Firefox but not with IE?
I'm using POST and a unique string for the url. See below. [Bindable] private var HTTPService_url:String = company.php?ForceIEReloadms= + new Date().getTime(); mx:HTTPService url={HTTPService_url} method=POST id=data resultFormat=e4x result=xmlResultHandler(event); fault=xmlFaultHandler(event);/ What I noticed is that in Firefox, I see the message Transferring data from localhost... appearing at the bottom left in the status bar... I can tell that every 30sec it updates whereas in IE, it always displays Done??? I think IE never runs the updateData function...? private function updateData(event:TimerEvent):void { data.send(); } Or maybe it kept the data.send values in cache... Any ideas? Thanks everyone. -David --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Sounds like caching to me as well. Are you using GET or POST? I use post exclusively and have no caching issues. The unique string on the url is an accepted solution as well. Tracy
[flexcoders] Re: sailorsea21 - RemoveChild question.
Hi Tracy, These are the errors I received in the debug: _aChildren[iIndexClicked] = errors during evaluation No such variable: undefined but the _aChildren variable is set as follows: private var _aChildren:Array=[]; and the iIndexClicked variable is set as follows: var iIndexClicked:int = parseInt(event.target.id); The iIndexClicked always returns an id=0 even if I loaded several modules... flash.display::DisplayObjectContainer/removeChild [no source] Here's the full function: private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); modulestile.removeChild(_aChildren[iIndexClicked]); modulestile.removeChild(DisplayObject(event.target)); } David --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Try the debug approaches I suggested. Tracy
[flexcoders] Re: sailorsea21 - RemoveChild question.
I got it working! Thanks Tracy. I removed the following line: modulestile.removeChild(DisplayObject(event.target)); I removed the following id: main_vbox.id = String(NewVbox); and assigned it to the unload button Thanks for all your help :) --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: First, in unloadclick, what is the intent of this line? modulestile.removeChild(DisplayObject(event.target)); Next, why is .id always = 0? You are setting it in AddModule with this line below. How are you incrementing the NewVbox variable each time? I shouwed you how to do that in an earlier post. main_vbox.id = String(NewVbox); Finally, in the error, No such variable: undefined which variable is not being found? Debug. Tracy
[flexcoders] Re: sailorsea21 - RemoveChild question.
I'm trying to re-introduce the VBox container to wrap the module and the button, this way each tile will display a module and a button together instead of seperating the module and button in seperate tiles but it always gives me the child error... Also, is it possible to have the unload button along with other buttons within a Hbox inside the Vbox? The VBox will contain my ModuleLoader and the Hbox. The Hbox will contain my unload button along with other buttons??? mx:Script ![CDATA[ import mx.containers.VBox; import mx.modules.ModuleLoader; import mx.controls.Button; private var main_vbox:VBox; private var moduleloader:ModuleLoader; private var unload_button:Button; private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); main_vbox.removeChild(_aChildren[iIndexClicked]); main_vbox.removeChild(DisplayObject(event.target)); } public function Add():void { var NewModule:int = _aChildren.length; main_vbox = new VBox(); modulestile.addChild(main_vbox); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[NewModule] = main_vbox.addChild(moduleloader); unload_button = new Button(); unload_button.label = unload; unload_button.id = String(NewModule); unload_button.addEventListener(MouseEvent.CLICK, unloadclick); main_vbox.addChild(unload_button); } ]] /mx:Script mx:Tile id=modulestile styleName=pad8 direction=horizontal/ Thanks again. --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Because you introduced the Vbox container. Neither the button or the moduleloader are children of modulestile, they are children of the Vbox. You now need to keep references to the Vbox instead, and remove that. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sailorsea21 Sent: Friday, October 17, 2008 3:21 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Thanks Paul, that fixed the error in my file but I still receive the error when I run my application, load modules and then try to unload a loaded module. Error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$remo http://www.adobe.com/2006/flex/mx/internal::$remo veChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\UIComponent.as:5074] at mx.core::Container/removeChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\Container.as:2267] at content_module_template_blank/unloadclick() [C:\Inetpub\wwwroot\LWY\UI\UI Score\UI Score 004 \src\content_module_template_blank.mxml:39] Thanks. --- In flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com , Paul Andrews paul@ wrote: - Original Message - From: sailorsea21 sailorsea21@ To: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com Sent: Friday, October 17, 2008 8:01 PM Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Here's my updated code: private var moduleloader:ModuleLoader; private var unload_button:Button; private var vbox:VBox; private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); modulestile.removeChild(_aChildren[iIndexClicked]); *error* modulestile.removeChild(event.target); *error* modulestile.removeChild(DisplayObject(event.target)); } public function AddColumnGraphPanel():void { var iNewIndex:int = _aChildren.length; vbox = new VBox(); modulestile.addChild(vbox); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[iNewIndex] = vbox.addChild(moduleloader); unload_button = new Button(); unload_button.id = String(iNewIndex); unload_button.label = unload; unload_button.addEventListener(MouseEvent.CLICK, unloadclick); vbox.addChild(unload_button); } mx:Tile id=modulestile direction=horizontal /mx:Tile I have the following error in the script: 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject. Quite right too.. Thanks again :) -David --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tspratt@ wrote: That is correct, you are not storing references correctly. First I
[flexcoders] Re: sailorsea21 - RemoveChild question.
This is what I am now trying to accomplish... I would like to have a VBOX container to wrap the module and the button. This way both items can be displayed in one tile instead of having them split into different tiles... Then I would like to have a HBOX container to wrap the unload button and other buttons... The VBOX has the ModuleLoader as a child and the HBOX. The HBOX has the unload button and other buttons as childs. Is this possible? Here's my code: mx:Script ![CDATA[ import mx.containers.VBox; import mx.containers.HBox; import mx.modules.ModuleLoader; import mx.controls.Button; private var main_vbox:VBox; private var buttons_hbox:HBox; private var moduleloader:ModuleLoader; private var unload_button:Button; private var button002:Button; private var button003:Button; private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); modulestile.removeChild(_aChildren[iIndexClicked]); modulestile.removeChild(DisplayObject(event.target)); } public function AddModule():void { var NewVbox:int = _aChildren.length; main_vbox = new VBox(); main_vbox.id = String(NewVbox); _aChildren[NewVbox] = modulestile.addChild(main_vbox); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; main_vbox.addChild(moduleloader); buttons_hbox = new HBox(); main_vbox.addChild(buttons_hbox); button002 = new Button(); button002.label = 002; buttons_hbox.addChild(button002); button003 = new Button(); button003.label = 003; buttons_hbox.addChild(button003); unload_button = new Button(); unload_button.label = unload; unload_button.addEventListener(MouseEvent.CLICK, unloadclick); buttons_hbox.addChild(unload_button); } ]] /mx:Script mx:Tile id=modulestile/ Thank you. --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Because you introduced the Vbox container. Neither the button or the moduleloader are children of modulestile, they are children of the Vbox. You now need to keep references to the Vbox instead, and remove that. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sailorsea21 Sent: Friday, October 17, 2008 3:21 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Thanks Paul, that fixed the error in my file but I still receive the error when I run my application, load modules and then try to unload a loaded module. Error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$remo http://www.adobe.com/2006/flex/mx/internal::$remo veChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\UIComponent.as:5074] at mx.core::Container/removeChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\Container.as:2267] at content_module_template_blank/unloadclick() [C:\Inetpub\wwwroot\LWY\UI\UI Score\UI Score 004 \src\content_module_template_blank.mxml:39] Thanks. --- In flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com , Paul Andrews paul@ wrote: - Original Message - From: sailorsea21 sailorsea21@ To: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com Sent: Friday, October 17, 2008 8:01 PM Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Here's my updated code: private var moduleloader:ModuleLoader; private var unload_button:Button; private var vbox:VBox; private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); modulestile.removeChild(_aChildren[iIndexClicked]); *error* modulestile.removeChild(event.target); *error* modulestile.removeChild(DisplayObject(event.target)); } public function AddColumnGraphPanel():void { var iNewIndex:int = _aChildren.length; vbox = new VBox(); modulestile.addChild(vbox); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[iNewIndex] = vbox.addChild(moduleloader); unload_button = new Button
[flexcoders] Re: sailorsea21 - RemoveChild question.
Hi Tracy, I don't think I'm successfully storing the reference of the children into the array. This is what I had tried: private var moduleloader:ModuleLoader; private var button:Button; private var _aChildren:Array; private function click(evt:MouseEvent):void { tiletest.removeChild(_aChildren[one]); tiletest.removeChild(button); } public function AddModule():void { moduleloader = new ModuleLoader(); moduleloader.url = test.swf; button = new Button(); button.label = unload; button.addEventListener(MouseEvent.CLICK, click); tiletest.addChild(button); _aChildren = new Array(); _aChildren[one] = tiletest.addChild(moduleloader); } But I keep getting the ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. error. Thanks again. -David --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Well, you did not do what I suggested. What do you think is in moduleloader when you click the remove button? The last thing you put in it. Re-read my response. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sailorsea21 Sent: Thursday, October 16, 2008 4:38 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Hi Tracy, thank you for your quick response. I'm a little stuck on this one... I can't get it to work... I'm now able to load a module and unload it. But if I load several modules, I'm only able to unload the latest one. When I try unloading the other loaded modules I receive the follow error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$remo http://www.adobe.com/2006/flex/mx/internal::$remo veChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\UIComponent.as:5074] at mx.core::Container/removeChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\Container.as:2267] at content_module_template_blank/click() [C:\Inetpub\wwwroot\LWY\UI\UI Score\UI Score 004 \src\content_module_template_blank.mxml:29] This is my code: import mx.states.RemoveChild; import mx.modules.ModuleLoader; import mx.controls.Button; private var moduleloader:ModuleLoader; private var button:Button; public function loadmodule():void { moduleloader = new ModuleLoader(); tiletest.addChild(moduleloader); moduleloader.url = test.swf; button = new Button(); button.label = unload; button.addEventListener(MouseEvent.CLICK, click); tiletest.addChild(button); } private function click(evt:MouseEvent):void { tiletest.removeChild(moduleloader); tiletest.removeChild(button); } mx:Tile width=100% height=100% id=tiletest/ mx:LinkButton label=Load click=loadmodule() buttonMode=true/ Thank you very much. -David.
[flexcoders] Re: sailorsea21 - RemoveChild question.
Here's my updated code: private var moduleloader:ModuleLoader; private var unload_button:Button; private var vbox:VBox; private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); modulestile.removeChild(_aChildren[iIndexClicked]); *error* modulestile.removeChild(event.target); *error* } public function AddColumnGraphPanel():void { var iNewIndex:int = _aChildren.length; vbox = new VBox(); modulestile.addChild(vbox); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[iNewIndex] = vbox.addChild(moduleloader); unload_button = new Button(); unload_button.id = String(iNewIndex); unload_button.label = unload; unload_button.addEventListener(MouseEvent.CLICK, unloadclick); vbox.addChild(unload_button); } mx:Tile id=modulestile direction=horizontal /mx:Tile I have the following error in the script: 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject. Thanks again :) -David --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: That is correct, you are not storing references correctly. First I will explain what is wrong with your code, but then, after seeing what you are trying to do, will suggest a slightly different approach. First, you are mixing Array, which is accessed by index and associative array, which is an Object and accessed by property name: private var _oChildren:Object = new Object(); Second, you are creating a new instance of that each time you click addModule. This overwrites what was in there before. Don't do that. Third, you need a unique name for each reference you add to the associative array. Don't use one every time, that just puts a new reference in the one property. You can use anything you want for this property name. Pick something that is meaningful. How will you identify which child you want to remove? Is it purely numerical? If so you can use 1, 2, etc. Usually there is some string that is logical for this, like an id, or an image's base file name. whatever, remember it must uniquely identify the instance you want to later remove. Now, after looking at your code a bit more, and seeing that you do not have a clear string or id you can use for identifying the references, I am gong to suggest a different approach. private var _aChildren:Array= []; //declare an initialize an Array ... public function addModule():void { var iNewIndex:int = _aChildren.length; //this will be the next available index in the array button = new Button(); button.id = String(iNewIndex); //NOTE: you can NOT use this id as a reference, but you CAN access its value button.label = unload; button.addEventListener(MouseEvent.CLICK, onClickUnload); tiletest.addChild(button); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[iNewIndex] = tiletest.addChild(moduleloader); //NOTE: the associated button id property value matches the index of the array ref }// addModule private function onClickUnload (event:Event):void { var iIndexClicked:int = parseInt(event.target.id); tiletest.removeChild(_aChildren[iIndexClicked]); tiletest.removeChild(event.target); }// onClickUnload Try this. it is untested. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sailorsea21 Sent: Friday, October 17, 2008 11:45 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Hi Tracy, I don't think I'm successfully storing the reference of the children into the array. This is what I had tried: private var moduleloader:ModuleLoader; private var button:Button; private var _aChildren:Array; private function click(evt:MouseEvent):void { tiletest.removeChild(_aChildren[one]); tiletest.removeChild(button); } public function AddModule():void { moduleloader = new ModuleLoader(); moduleloader.url = test.swf; button = new Button(); button.label = unload; button.addEventListener(MouseEvent.CLICK, click); tiletest.addChild(button); _aChildren = new Array(); _aChildren[one] = tiletest.addChild(moduleloader); } But I keep getting the ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. error. Thanks again. -David --- In flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com , Tracy Spratt tspratt@ wrote: Well, you did not do what I suggested. What do you think is in moduleloader when you
[flexcoders] Re: sailorsea21 - RemoveChild question.
Thanks Paul, that fixed the error in my file but I still receive the error when I run my application, load modules and then try to unload a loaded module. Error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$remo veChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\UIComponent.as:5074] at mx.core::Container/removeChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\Container.as:2267] at content_module_template_blank/unloadclick() [C:\Inetpub\wwwroot\LWY\UI\UI Score\UI Score 004 \src\content_module_template_blank.mxml:39] Thanks. --- In flexcoders@yahoogroups.com, Paul Andrews [EMAIL PROTECTED] wrote: - Original Message - From: sailorsea21 [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, October 17, 2008 8:01 PM Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Here's my updated code: private var moduleloader:ModuleLoader; private var unload_button:Button; private var vbox:VBox; private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); modulestile.removeChild(_aChildren[iIndexClicked]); *error* modulestile.removeChild(event.target); *error* modulestile.removeChild(DisplayObject(event.target)); } public function AddColumnGraphPanel():void { var iNewIndex:int = _aChildren.length; vbox = new VBox(); modulestile.addChild(vbox); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[iNewIndex] = vbox.addChild(moduleloader); unload_button = new Button(); unload_button.id = String(iNewIndex); unload_button.label = unload; unload_button.addEventListener(MouseEvent.CLICK, unloadclick); vbox.addChild(unload_button); } mx:Tile id=modulestile direction=horizontal /mx:Tile I have the following error in the script: 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject. Quite right too.. Thanks again :) -David --- In flexcoders@yahoogroups.com, Tracy Spratt tspratt@ wrote: That is correct, you are not storing references correctly. First I will explain what is wrong with your code, but then, after seeing what you are trying to do, will suggest a slightly different approach. First, you are mixing Array, which is accessed by index and associative array, which is an Object and accessed by property name: private var _oChildren:Object = new Object(); Second, you are creating a new instance of that each time you click addModule. This overwrites what was in there before. Don't do that. Third, you need a unique name for each reference you add to the associative array. Don't use one every time, that just puts a new reference in the one property. You can use anything you want for this property name. Pick something that is meaningful. How will you identify which child you want to remove? Is it purely numerical? If so you can use 1, 2, etc. Usually there is some string that is logical for this, like an id, or an image's base file name. whatever, remember it must uniquely identify the instance you want to later remove. Now, after looking at your code a bit more, and seeing that you do not have a clear string or id you can use for identifying the references, I am gong to suggest a different approach. private var _aChildren:Array= []; //declare an initialize an Array ... public function addModule():void { var iNewIndex:int = _aChildren.length; //this will be the next available index in the array button = new Button(); button.id = String(iNewIndex); //NOTE: you can NOT use this id as a reference, but you CAN access its value button.label = unload; button.addEventListener(MouseEvent.CLICK, onClickUnload); tiletest.addChild(button); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[iNewIndex] = tiletest.addChild (moduleloader); //NOTE: the associated button id property value matches the index of the array ref }// addModule private function onClickUnload (event:Event):void { var iIndexClicked:int = parseInt(event.target.id); tiletest.removeChild(_aChildren[iIndexClicked]); tiletest.removeChild(event.target); }// onClickUnload Try this. it is untested. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sailorsea21 Sent: Friday, October 17, 2008 11:45 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Hi Tracy, I don't
[flexcoders] Re: sailorsea21 - RemoveChild question.
DOH! Thank you very much for your help :) -David --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Because you introduced the Vbox container. Neither the button or the moduleloader are children of modulestile, they are children of the Vbox. You now need to keep references to the Vbox instead, and remove that. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of sailorsea21 Sent: Friday, October 17, 2008 3:21 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Thanks Paul, that fixed the error in my file but I still receive the error when I run my application, load modules and then try to unload a loaded module. Error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$remo http://www.adobe.com/2006/flex/mx/internal::$remo veChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\UIComponent.as:5074] at mx.core::Container/removeChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\Container.as:2267] at content_module_template_blank/unloadclick() [C:\Inetpub\wwwroot\LWY\UI\UI Score\UI Score 004 \src\content_module_template_blank.mxml:39] Thanks. --- In flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com , Paul Andrews paul@ wrote: - Original Message - From: sailorsea21 sailorsea21@ To: flexcoders@yahoogroups.com mailto:flexcoders% 40yahoogroups.com Sent: Friday, October 17, 2008 8:01 PM Subject: [flexcoders] Re: sailorsea21 - RemoveChild question. Here's my updated code: private var moduleloader:ModuleLoader; private var unload_button:Button; private var vbox:VBox; private var _aChildren:Array=[]; private function unloadclick(event:Event):void { var iIndexClicked:int = parseInt(event.target.id); modulestile.removeChild(_aChildren[iIndexClicked]); *error* modulestile.removeChild(event.target); *error* modulestile.removeChild(DisplayObject(event.target)); } public function AddColumnGraphPanel():void { var iNewIndex:int = _aChildren.length; vbox = new VBox(); modulestile.addChild(vbox); moduleloader = new ModuleLoader(); moduleloader.url = test.swf; _aChildren[iNewIndex] = vbox.addChild(moduleloader); unload_button = new Button(); unload_button.id = String(iNewIndex); unload_button.label = unload; unload_button.addEventListener(MouseEvent.CLICK, unloadclick); vbox.addChild(unload_button); } mx:Tile id=modulestile direction=horizontal /mx:Tile I have the following error in the script: 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject. Quite right too.. Thanks again :) -David --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tspratt@ wrote: That is correct, you are not storing references correctly. First I will explain what is wrong with your code, but then, after seeing what you are trying to do, will suggest a slightly different approach. First, you are mixing Array, which is accessed by index and associative array, which is an Object and accessed by property name: private var _oChildren:Object = new Object(); Second, you are creating a new instance of that each time you click addModule. This overwrites what was in there before. Don't do that. Third, you need a unique name for each reference you add to the associative array. Don't use one every time, that just puts a new reference in the one property. You can use anything you want for this property name. Pick something that is meaningful. How will you identify which child you want to remove? Is it purely numerical? If so you can use 1, 2, etc. Usually there is some string that is logical for this, like an id, or an image's base file name. whatever, remember it must uniquely identify the instance you want to later remove. Now, after looking at your code a bit more, and seeing that you do not have a clear string or id you can use for identifying the references, I am gong to suggest a different approach. private var _aChildren:Array= []; //declare an initialize an Array ... public function addModule():void { var iNewIndex:int = _aChildren.length; //this will be the next available index in the array button = new Button(); button.id = String(iNewIndex); //NOTE: you can NOT use this id as a reference, but you CAN access its value button.label = unload
[flexcoders] sailorsea21 - How can I add the progress loading box when I load a module?
Hi everyone, how can I add the progress loading box when I load a module? Is it an automated thing with flex or must I code it? Thanks. :)
[flexcoders] sailorsea21 - RemoveChild question.
Hi, I have a Tile in my application: mx:Tile width=100% height=100% id=tiletest/ I also have a linkbutton that loads moduleloaders in mx:Tile: mx:LinkButton label=Load click=loadmodule() buttonMode=true/ mx:Script ![CDATA[ import mx.modules.ModuleLoader; public function loadmodule():void { var moduleloader:ModuleLoader = new ModuleLoader(); tiletest.addChild(moduleloader); moduleloader.url = test.swf; } ]] /mx:Script I can load the module several times but my problem is: If I load several modules, how can I remove a specific one, let's say the third one that was loaded? Do I need to add a specific remove button within the module application? If so, what script can I use??? Thank you.
[flexcoders] Re: sailorsea21 - RemoveChild question.
Hi Tracy, thank you for your quick response. I'm a little stuck on this one... I can't get it to work... I'm now able to load a module and unload it. But if I load several modules, I'm only able to unload the latest one. When I try unloading the other loaded modules I receive the follow error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$remo veChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\UIComponent.as:5074] at mx.core::Container/removeChild()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\core\Container.as:2267] at content_module_template_blank/click() [C:\Inetpub\wwwroot\LWY\UI\UI Score\UI Score 004 \src\content_module_template_blank.mxml:29] This is my code: import mx.states.RemoveChild; import mx.modules.ModuleLoader; import mx.controls.Button; private var moduleloader:ModuleLoader; private var button:Button; public function loadmodule():void { moduleloader = new ModuleLoader(); tiletest.addChild(moduleloader); moduleloader.url = test.swf; button = new Button(); button.label = unload; button.addEventListener(MouseEvent.CLICK, click); tiletest.addChild(button); } private function click(evt:MouseEvent):void { tiletest.removeChild(moduleloader); tiletest.removeChild(button); } mx:Tile width=100% height=100% id=tiletest/ mx:LinkButton label=Load click=loadmodule() buttonMode=true/ Thank you very much. -David.
[flexcoders] Internet Explorer bug? Automatic updating of chart works in Firefox not in IE...
Hi everyone. I have a chart that is populated from a MySQL database via PHPXML. The chart is automatically updated every 30 seconds. This works perfectly in Firefox but in Internet Explorer it never updates Here is my script, hope this can help: mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; [Bindable] private var myxmldata:ArrayCollection = new ArrayCollection; [Bindable] private var xmlFeed:XML; private function xmlResultHandler(event:ResultEvent):void { myxmldata.removeAll() ; xmlFeed = event.result as XML; for each(var ourxml:XML in xmlFeed.elements() ) myxmldata.addItem(ourxml); } private function xmlFaultHandler(event:FaultEvent):void { var faultMessage:String = Could not connect with XML file; Alert.show(faultMessage, Error opening file); } public function initTimer():void { var myTimer:Timer = new Timer(3); myTimer.addEventListener(TimerEvent.TIMER,updateData); myTimer.start(); } private function updateData(event:TimerEvent):void { data.send(); } ]] /mx:Script Thanks!
[flexcoders] How can I create a dynamic button that adds a new panel in my mx:Tile?
Hello everyone, How can I create a dynamic button that adds a new panel or canvas in my mx:Tile/mx:Tile everytime I click it? Thanks!
[flexcoders] Flex / Data / Create Application from Database - Can this also work as a module?
Hi, I had a question, When I create an application from a Database (Flex / Data / Create Application from Database). Can I modify the code to convert it into a module? I have a main application that I would like to load the Database as a module. I tried replacing the mx:Application Tags to mx:Module but didn't work... Thanks.
[flexcoders] Re: Flex / Data / Create Application from Database - Can this also work as a module?
It worked!!! Thanks :) --- In flexcoders@yahoogroups.com, Flex Gangsta [EMAIL PROTECTED] wrote: You could probably just wrap all the children of the mxml file(not application) in a mxml component. If I understood you correctly, this is the structure you wanted to achieve. Sent from my iPhone On Oct 10, 2008, at 8:41 AM, sailorsea21 [EMAIL PROTECTED] wrote: Hi, I had a question, When I create an application from a Database (Flex / Data / Create Application from Database). Can I modify the code to convert it into a module? I have a main application that I would like to load the Database as a module. I tried replacing the mx:Application Tags to mx:Module but didn't work... Thanks. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f- b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo ! Groups Links
[flexcoders] Preventing Modules from being Cached???
How can I prevent a module from being cached? Thanks.
[flexcoders] Loading, unloading and then re-loading a module with a chart populated from a My
Hi everyone, I can find a solution to my problem... Loading, unloading and then re-loading a module with a chart populated from a MySQL database gives me this error: TypeError: Error #1034: Type Coercion failed: cannot convert mx.managers::[EMAIL PROTECTED] to mx.managers.IDragManager. at mx.managers::DragManager$/get impl()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\managers\DragManager.as:152] at mx.managers::DragManager$/get isDragging()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\managers\DragManager.as:187] at mx.controls.listClasses::ListBase/dragScroll()[E:\dev\3.1.0 \frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as :7149] at Function/http://adobe.com/AS3/2006/builtin::apply() at anonymous() at SetIntervalTimer/onTimer() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick() I load a module into my application. It works great. I then unload my module using the following code: content_module.unloadModule(); If I reload the module later on, I get the error above... Help would be greatly appreciated! -David