Mailing List
Home
Forum Home
Flash Pro
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Re: [Flashcoders] Scoping problem within Class: passing result of
onLoad event

Re: [Flashcoders] Scoping problem within Class: passing result of
onLoad event

2004-03-14       - By Mark Winterhalder

 Back
Reply:     1     2     3  

John,

i don't quite get what this extra function is for, either.
why not set self.appIsOnline = success directly instead of
self.passLoadResult( success ) ?
or why not set self.online = success and save the setter, or do you
intend to use the setter appIsOnline at some point?
if you don't plan on using it from outside the class, the setter should
not be there (appIsOnline as read only property).

mark

L A I V E R D wrote:

>Mark,
>
>Thanks for helping me trying to find the light again ;-) I tried your
>suggestion before, as the thought occurred to me also. Hoewever whatever
>I did (such as a trace on 'online' using the getter appIsOnline in a
>button action); online always came up as undefined. Therefore I thought
>of a scoping problem. Anyway; I solved it with this code (thanks to
>Helen), but it seems feels a little clumsy to have to bring in a third
>function to pass the result of the onLoad event.
>
>class Test {
>   private var online:Boolean;
>   private var onlineURL:String =
>"http://www.laiverd.com/groundzero/online/online.txt";
>   // constructor
>   function Test() {
>     checkOnline();
>   }
>   // functions
>   public function checkOnline() {
>     var self = this;
>     var onlineCheck_lv:LoadVars = new LoadVars();
>     onlineCheck_lv.onLoad = function(success) {
>       self.passLoadResult(success);
>     };
>     onlineCheck_lv.load(onlineURL + "?nocacheVar=" +
>Math.random());
>   }
>   private function passLoadResult(param) {
>     appIsOnline = param;
>   }
>   // setters
>   function set appIsOnline(val:Boolean) {
>     online = val;
>   }
>   // getters
>   function get appIsOnline() {
>     return online;
>   }
>}
>
>So it's dawning right now, but full sun is still welcome, unless the
>clumsy way is the only way, in which case I'll juts have to turn the
>switch ;-)
>
>John
>  
>


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106909
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)