RE: [flexcoders] Applications forgetting variables
As in, are you possible creating new instances of classes when you thought you were using an instance that was created previously. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, November 10, 2005 8:08 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Applications forgetting variables What do you mean recreating classes -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Applications forgetting variables
What do you mean recreating classes -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Applications forgetting variables
Nope, are you sure you’re not re-creating classes? From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, November 09, 2005 9:04 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Applications forgetting variables I have had a problem with my applications forgetting the values of variables. My application has one mxml file and several .as files and it seems to forget the values at times in the process of running. What I want to know is this if I declare a variable in one .as file do I have to declare it in all .as files even if its not going to be called or used? -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Applications forgetting variables
Create a new sample application that shows the problem you are having. It is important to have an entire sample that we can run immediately, and that has only the minimum code required to show the issue. Tracy From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, May 26, 2005 1:16 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Applications forgetting variables perhaps you are right do you know of any such tutorial. The reason I do not post a lot of my code is its way to long and complicated. I would rather post a simple example of code Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Applications forgetting variables
perhaps you are right do you know of any such tutorial. The reason I do not post a lot of my code is its way to long and complicated. I would rather post a simple example of code Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Applications forgetting variables
An instance variable is inside a class, but outside that class's methods. A local variable is inside one of the methods. public class MyClass { var myInstanceVariable:String; public function myMethod():Void { var myLocalVariable:String = "Gordon"; trace(myLocalVariable); } } Questions like this are definitely not silly, but they're questions about object-oriented programming, not about Flex per se. You would face similar issues with other OO programnming environments. - Gordon From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, May 25, 2005 2:31 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Applications forgetting variables Ok assuming your right and again I hope this is not another silly question but what does a local variable look like and what does an instance variable look like? To me I just thought all variables were just like this public var name:String you know things like that Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Applications forgetting variables
It all depends on WHERE you declare the variable. In the first case, you were defining your var outisde of the function, which should keep its value even when the function is through running. If you declare the var inside the function, however, that variable will be destroyed when that function is through running. You really should read a tutorial or chapter on Variable Scope, and post your code here, because you're not giving us much to work with. Cheers On 5/25/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Ok assuming your right and again I hope this is not another silly question > but what does a local variable look like and what does an instance variable > look like? To me I just thought all variables were just like this > public var name:String > you know things like that > > > Yahoo! Groups Links > > To visit your group on the web, go to: > http://groups.yahoo.com/group/flexcoders/ > > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- Jordan Snyder Applications Developer ImageAction, USA http://www.imageaction.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Applications forgetting variables
Ok assuming your right and again I hope this is not another silly question but what does a local variable look like and what does an instance variable look like? To me I just thought all variables were just like this public var name:String you know things like that Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Applications forgetting variables
The difference between these two approaches is scope. In your first example u create a variable on the instance of the class u are working in. This variable exists as long as that instance has a reference somewhere in the application. In the second example u create a variable inside a function definition. This means that at the }, the end of the function this variable is destroyed. Greetz Erik From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]Sent: woensdag 25 mei 2005 4:41To: flexcoders@yahoogroups.comSubject: [flexcoders] Applications forgetting variables I can not help but feel I have ran in to more problems than neccessary because my flex applicaitons forget variables. I mean I know from a code standpoint I am doing the right thing when I write my code but I think it forgets variables and I think this is causing me more stress than need be. What I want to know is how does someone go about making sure it does not forget variables I mean is this a way to do it: If I have a function and a variable that looks like this say: public var age:Number public function compute(){ age = 23 } but lets say that for some odd reason when you get to the compute function it keeps forgetting the age variable will this solve it to write the function like this: public function compute(){ var age:Number age = 23 } If there is any other suggestions let me know Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Applications forgetting variables
It is 99.% likely that you have a coding error, but I can't tell you what it is if you won't post malfunctioning code. : ) It certainly sounds like you are declaring a local variable when you should be using an instance variable. - Gordon From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, May 24, 2005 9:58 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Applications forgetting variables I will set a variable to be a certain amount in one function then call it in a later function and its completely forgotten it Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Applications forgetting variables
I will set a variable to be a certain amount in one function then call it in a later function and its completely forgotten it Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Applications forgetting variables
Can you be more specific about what you mean when you say "it keeps forgetting", or post a tiny but complete that demonstrates the problem? The meanings of 'var age' in your two examples are very different. Your second example would "forget" that you set age to 23, because you are setting a local (or temporary) variable in the compute function, and local variables go away when the function they are in returns. The first example would not "forget" the 23 because you are setting an instance variable on whatever the 'this' object is; instance variables last as long as the object itself. - Gordon From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, May 24, 2005 7:41 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Applications forgetting variables I can not help but feel I have ran in to more problems than neccessary because my flex applicaitons forget variables. I mean I know from a code standpoint I am doing the right thing when I write my code but I think it forgets variables and I think this is causing me more stress than need be. What I want to know is how does someone go about making sure it does not forget variables I mean is this a way to do it: If I have a function and a variable that looks like this say: public var age:Num public function compute(){ age = 23 } but lets say that for some odd reason when you get to the compute function it keeps forgetting the age variable will this solve it to write the function like this: public function compute(){ var age:Number age = 23 } If there is any other suggestions let me know Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.