RE: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5
Can anybody tell how to disable refresh button of browser in flex From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ben Lucyk Sent: Thursday, December 08, 2005 6:04 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 Well, your post made a little more sense after reading your article! :) It sure does go in depth, but it's definitely an interesting read. http://www.macromedia.com/devnet/flex/articles/link_load_print.html Thanks a bunch Roger... ~thumbs up~ -Ben On 12/7/05, Roger Gonzalez [EMAIL PROTECTED] wrote: In 1.5, wetracked the dependencies of static initializers for inclusion in the SWF, but because the statics are actually initialized while the movie is streaming in, we would also have needed to have tracked things to ensure that all classes referenced in thedependencytree of the right hand side of the static initializerare all earlier in the stream. This was an overconstrained problem with few useful solutions. What I added as a workaround was to at least track the LHS of static initializers for ordering. This lets you resolve stuff with a bit of manual pain. I wrote a devnet article that goes into more detail, if you feel like digging it up. The solution for 2.0 was to reduce the need for strict ordering for statics by not initializingstuff until the end of the frame. This way we just have the requirement that your references must be on the same frame (or earlier), but don't need to have strict ordering within the frame. Much more solvable! -Roger Roger Gonzalez [EMAIL PROTECTED] From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Ben Lucyk Sent: Wednesday, December 07, 2005 2:15 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 Thanks for the tip Matt. Do you have any more details (or a good reference to point me towards) as to why this is the case though? There doesn't seem to be any problem initializingan instance variable this way at the component level. Has this behavior changed at all in Flex 2.0 that you know of? Ben On 12/6/05, Matt Chotin [EMAIL PROTECTED] wrote: Instance variable assignment in the declaration is always dangerous because dependencies are generally not tracked for initialization purposes. Assigning the variable in a function that's called later (like creationComplete or even initialize) is considered the best-practice. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ben Lucyk Sent: Tuesday, December 06, 2005 1:03 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 OK, help me outhere, 'cause I've been scratchin' my head a little too hard on this one... What I'm trying to do is setup a simple static class to use as a pointer to my main, global model, from within my MXML components. I've been running into some interesting behavior that I can't explain, and I'm wondering if anyone can help shed some light. (Couldn't find much help in the docs or forums) I'm seeing that when I'm at the mx:Application level and I try to bind to a global variable that is initialized from the static class I mentioned above, no binding takes place unless I initialize the var after creationComplete(). This is NOT required however, when I'm trying to use the same type of binding in a component. (The var seems to initialize fine) I should mention that I've also tested this using a normal class (var resource:String = new com.StaticResource().test;), and also a singleton class (var resource = com.StaticResource.getInstance().test;). No difference. Any thoughts? Sample Code ! StaticResource.as --- class com.StaticResource { public static var test:String = Bliggidy!; } ! ! testStaticBinding.mxml --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx= http://www.macromedia.com/2003/mxml creationComplete=doCreated() mx:Script ![CDATA[ // Does not work here, only at component level! //var resource:String = com.StaticResource.test; var resource:String; function doCreated() { // Var must be set AFTER creationComplete in // order to bind successfully! resource = com.StaticResource.test; } ]] /mx:Script mx:HBox mx:Label text=Parent Level: / mx:Label text={resource} / /mx:HBox components:testStaticBindingComponent xmlns:components=components.* / /mx:Application
Re: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5
Thanks for the tip Matt. Do you have any more details (or a good reference to point me towards) as to why this is the case though? There doesn't seem to be any problem initializingan instance variable this way at the component level. Has this behavior changed at all in Flex 2.0 that you know of? Ben On 12/6/05, Matt Chotin [EMAIL PROTECTED] wrote: Instance variable assignment in the declaration is always dangerous because dependencies are generally not tracked for initialization purposes. Assigning the variable in a function that's called later (like creationComplete or even initialize) is considered the best-practice. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ben LucykSent: Tuesday, December 06, 2005 1:03 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 OK, help me outhere, 'cause I've been scratchin' my head a little too hard on this one... What I'm trying to do is setup a simple static class to use as a pointer to my main, global model, from within my MXML components. I've been running into some interesting behavior that I can't explain, and I'm wondering if anyone can help shed some light. (Couldn't find much help in the docs or forums) I'm seeing that when I'm at the mx:Application level and I try to bind to a global variable that is initialized from the static class I mentioned above, no binding takes place unless I initialize the var after creationComplete(). This is NOT required however, when I'm trying to use the same type of binding in a component. (The var seems to initialize fine) I should mention that I've also tested this using a normal class (var resource:String = new com.StaticResource().test;), and also a singleton class (var resource = com.StaticResource.getInstance().test;). No difference. Any thoughts? Sample Code ! StaticResource.as --- class com.StaticResource { public static var test:String = Bliggidy!;} ! ! testStaticBinding.mxml --- ?xml version=1.0 encoding=utf-8?mx:Application xmlns:mx= http://www.macromedia.com/2003/mxml creationComplete=doCreated() mx:Script![CDATA[ // Does not work here, only at component level!//var resource:String = com.StaticResource.test;var resource:String; function doCreated() {// Var must be set AFTER creationComplete in // order to bind successfully!resource = com.StaticResource.test;} ]]/mx:Scriptmx:HBoxmx:Label text=Parent Level: /mx:Label text={resource} / /mx:HBoxcomponents:testStaticBindingComponent xmlns:components=components.* //mx:Application ! !-- testStaticBindingComponent.mxml--- ?xml version=1.0 encoding=utf-8?mx:HBox xmlns:mx= http://www.macromedia.com/2003/mxml mx:Script ![CDATA[ // Does NOT need to wait for creationComplete() in order to // bind successfully! var componentResource:String = com.StaticResource.test; //OK... ]] /mx:Script mx:Label text=Component Level: / mx:Label text={componentResource} //mx:HBox ! Also, how are ModelLocators typically implemented using the Cairngorm framework?Thanks in advance,-Ben Lucyk --Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch 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. -- Ben Lucyk(403) 809-3514[EMAIL PROTECTED] -- 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] Variable Initialization Bug? Data Binding Issues in Flex 1.5
In 1.5, wetracked the dependencies of static initializers for inclusion in the SWF, but because the statics are actually initialized while the movie is streaming in, we would also have needed to have tracked things to ensure that all classes referenced in thedependencytree of the right hand side of the static initializerare all earlier in the stream. This was an overconstrained problem with few useful solutions. What I added as a workaround was to at least track the LHS of static initializers for ordering. This lets you resolve stuff with a bit of manual pain. I wrote a devnet article that goes into more detail, if you feel like digging it up. The solution for 2.0 was to reduce the need for strict ordering for statics by not initializingstuff until the end of the frame. This way we just have the requirement that your references must be on the same frame (or earlier), but don't need to have strict ordering within the frame. Much more solvable! -RogerRoger Gonzalez[EMAIL PROTECTED] From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ben LucykSent: Wednesday, December 07, 2005 2:15 PMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 Thanks for the tip Matt. Do you have any more details (or a good reference to point me towards) as to why this is the case though? There doesn't seem to be any problem initializingan instance variable this way at the "component" level. Has this behavior changed at all in Flex 2.0 that you know of? Ben On 12/6/05, Matt Chotin [EMAIL PROTECTED] wrote: Instance variable assignment in the declaration is always dangerous because dependencies are generally not tracked for initialization purposes. Assigning the variable in a function that's called later (like creationComplete or even initialize) is considered the best-practice. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ben LucykSent: Tuesday, December 06, 2005 1:03 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 OK, help me outhere, 'cause I've been scratchin' my head a little too hard on this one... What I'm trying to do is setup a simple static class to use as a pointer to my main, global model, from within my MXML components. I've been running into some "interesting" behavior that I can't explain, and I'm wondering if anyone can help shed some light. (Couldn't find much help in the docs or forums) I'm seeing that when I'm at the mx:Application level and I try to bind to a "global" variable that is initialized from the static class I mentioned above, no binding takes place unless I initialize the var after creationComplete(). This is NOT required however, when I'm trying to use the same type of binding in a component. (The var seems to initialize fine) I should mention that I've also tested this using a "normal" class (var resource:String = new com.StaticResource().test;), and also a singleton class (var resource = com.StaticResource.getInstance().test;). No difference. Any thoughts? Sample Code ! StaticResource.as --- class com.StaticResource { public static var test:String = "Bliggidy!";} ! ! testStaticBinding.mxml --- ?xml version="1.0" encoding="utf-8"?mx:Application xmlns:mx=" http://www.macromedia.com/2003/mxml" creationComplete="doCreated()" mx:Script![CDATA[ // Does not work here, only at "component" level!//var resource:String = com.StaticResource.test;var resource:String; function doCreated() {// Var must be set AFTER creationComplete in // order to bind successfully!resource = com.StaticResource.test;} ]]/mx:Scriptmx:HBoxmx:Label text="Parent Level:" /mx:Label text="{resource}" / /mx:HBoxcomponents:testStaticBindingComponent xmlns:components="components.*" //mx:Application ! !-- testStaticBindingComponent.mxml--- ?xml version="1.0" encoding="utf
Re: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5
Well, your post made a little more sense after reading your article! :) It sure does go in depth, but it's definitely an interesting read. http://www.macromedia.com/devnet/flex/articles/link_load_print.html Thanks a bunch Roger... ~thumbs up~ -Ben On 12/7/05, Roger Gonzalez [EMAIL PROTECTED] wrote: In 1.5, wetracked the dependencies of static initializers for inclusion in the SWF, but because the statics are actually initialized while the movie is streaming in, we would also have needed to have tracked things to ensure that all classes referenced in thedependencytree of the right hand side of the static initializerare all earlier in the stream. This was an overconstrained problem with few useful solutions. What I added as a workaround was to at least track the LHS of static initializers for ordering. This lets you resolve stuff with a bit of manual pain. I wrote a devnet article that goes into more detail, if you feel like digging it up. The solution for 2.0 was to reduce the need for strict ordering for statics by not initializingstuff until the end of the frame. This way we just have the requirement that your references must be on the same frame (or earlier), but don't need to have strict ordering within the frame. Much more solvable! -RogerRoger Gonzalez[EMAIL PROTECTED] From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Ben LucykSent: Wednesday, December 07, 2005 2:15 PMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 Thanks for the tip Matt. Do you have any more details (or a good reference to point me towards) as to why this is the case though? There doesn't seem to be any problem initializingan instance variable this way at the component level. Has this behavior changed at all in Flex 2.0 that you know of? Ben On 12/6/05, Matt Chotin [EMAIL PROTECTED] wrote: Instance variable assignment in the declaration is always dangerous because dependencies are generally not tracked for initialization purposes. Assigning the variable in a function that's called later (like creationComplete or even initialize) is considered the best-practice. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ben LucykSent: Tuesday, December 06, 2005 1:03 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 OK, help me outhere, 'cause I've been scratchin' my head a little too hard on this one... What I'm trying to do is setup a simple static class to use as a pointer to my main, global model, from within my MXML components. I've been running into some interesting behavior that I can't explain, and I'm wondering if anyone can help shed some light. (Couldn't find much help in the docs or forums) I'm seeing that when I'm at the mx:Application level and I try to bind to a global variable that is initialized from the static class I mentioned above, no binding takes place unless I initialize the var after creationComplete(). This is NOT required however, when I'm trying to use the same type of binding in a component. (The var seems to initialize fine) I should mention that I've also tested this using a normal class (var resource:String = new com.StaticResource().test;), and also a singleton class (var resource = com.StaticResource.getInstance().test;). No difference. Any thoughts? Sample Code ! StaticResource.as --- class com.StaticResource { public static var test:String = Bliggidy!;} ! ! testStaticBinding.mxml --- ?xml version=1.0 encoding=utf-8?mx:Application xmlns:mx= http://www.macromedia.com/2003/mxml creationComplete=doCreated() mx:Script![CDATA[ // Does not work here, only at component level!//var resource:String = com.StaticResource.test;var resource:String; function doCreated() {// Var must be set AFTER creationComplete in // order to bind successfully!resource = com.StaticResource.test;} ]]/mx:Scriptmx:HBoxmx:Label text=Parent Level: /mx:Label text={resource} / /mx:HBoxcomponents:testStaticBindingComponent xmlns:components=components.* //mx:Application ! !-- testStaticBindingComponent.mxml--- ?xml version=1.0 encoding=utf-8?mx:HBox xmlns:mx= http://www.macromedia.com/2003/mxml mx:Script ![CDATA[ // Does NOT need to wait for creationComplete() in order to // bind successfully! var componentResource:String = com.StaticResource.test; //OK... ]] /mx:Script mx:Label text=Component Level: / mx:Label text={componentResource} //mx:HBox ! Also, how are ModelLocators typically implemented using the Cairngorm framework
[flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5
OK, help me outhere, 'cause I've been scratchin' my head a little too hard on this one... What I'm trying to do is setup a simple static class to use as a pointer to my main, global model, from within my MXML components. I've been running into some interesting behavior that I can't explain, and I'm wondering if anyone can help shed some light. (Couldn't find much help in the docs or forums) I'm seeing that when I'm at the mx:Application level and I try to bind to a global variable that is initialized from the static class I mentioned above, no binding takes place unless I initialize the var after creationComplete(). This is NOT required however, when I'm trying to use the same type of binding in a component. (The var seems to initialize fine) I should mention that I've also tested this using a normal class (var resource:String = new com.StaticResource().test;), and also a singleton class (var resource = com.StaticResource.getInstance().test;). No difference. Any thoughts? Sample Code ! StaticResource.as --- class com.StaticResource { public static var test:String = Bliggidy!;} ! ! testStaticBinding.mxml --- ?xml version=1.0 encoding=utf-8?mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml creationComplete=doCreated() mx:Script![CDATA[ // Does not work here, only at component level!//var resource:String = com.StaticResource.test;var resource:String;function doCreated() {// Var must be set AFTER creationComplete in // order to bind successfully!resource = com.StaticResource.test;} ]]/mx:Scriptmx:HBoxmx:Label text=Parent Level: /mx:Label text={resource} //mx:HBox components:testStaticBindingComponent xmlns:components=components.* //mx:Application ! !-- testStaticBindingComponent.mxml--- ?xml version=1.0 encoding=utf-8?mx:HBox xmlns:mx=http://www.macromedia.com/2003/mxml mx:Script ![CDATA[ // Does NOT need to wait for creationComplete() in order to // bind successfully! var componentResource:String = com.StaticResource.test; //OK... ]] /mx:Script mx:Label text=Component Level: / mx:Label text={componentResource} //mx:HBox ! Also, how are ModelLocators typically implemented using the Cairngorm framework?Thanks in advance,-Ben Lucyk -- 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. attachment: screenshot.JPG
RE: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5
Instance variable assignment in the declaration is always dangerous because dependencies are generally not tracked for initialization purposes. Assigning the variable in a function thats called later (like creationComplete or even initialize) is considered the best-practice. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ben Lucyk Sent: Tuesday, December 06, 2005 1:03 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Variable Initialization Bug? Data Binding Issues in Flex 1.5 OK, help me outhere, 'cause I've been scratchin' my head a little too hard on this one... What I'm trying to do is setup a simple static class to use as a pointer to my main, global model, from within my MXML components. I've been running into some interesting behavior that I can't explain, and I'm wondering if anyone can help shed some light. (Couldn't find much help in the docs or forums) I'm seeing that when I'm at the mx:Application level and I try to bind to a global variable that is initialized from the static class I mentioned above, no binding takes place unless I initialize the var after creationComplete(). This is NOT required however, when I'm trying to use the same type of binding in a component. (The var seems to initialize fine) I should mention that I've also tested this using a normal class (var resource:String = new com.StaticResource().test;), and also a singleton class (var resource = com.StaticResource.getInstance().test;). No difference. Any thoughts? Sample Code ! StaticResource.as --- class com.StaticResource { public static var test:String = Bliggidy!; } ! ! testStaticBinding.mxml --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml creationComplete=doCreated() mx:Script ![CDATA[ // Does not work here, only at component level! //var resource:String = com.StaticResource.test; var resource:String; function doCreated() { // Var must be set AFTER creationComplete in // order to bind successfully! resource = com.StaticResource.test; } ]] /mx:Script mx:HBox mx:Label text=Parent Level: / mx:Label text={resource} / /mx:HBox components:testStaticBindingComponent xmlns:components=components.* / /mx:Application ! !-- testStaticBindingComponent.mxml--- ?xml version=1.0 encoding=utf-8? mx:HBox xmlns:mx=http://www.macromedia.com/2003/mxml mx:Script ![CDATA[ // Does NOT need to wait for creationComplete() in order to // bind successfully! var componentResource:String = com.StaticResource.test; //OK... ]] /mx:Script mx:Label text=Component Level: / mx:Label text={componentResource} / /mx:HBox ! Also, how are ModelLocators typically implemented using the Cairngorm framework? Thanks in advance, -Ben Lucyk -- 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.