This content has been marked as final. Show 8 replies
'this' inside an event normally refers to the object that holds that event, so inside 'onResult', it refers to the PendingCall object. There's not _parent property in that, so you can't get to the component this way. Instead, try to pass a reference to the component to the event:
var me = this; // in openService()
wsGetAllVals.onResult = function (result)
me.sensorMax = "400";
trace("All Values received");
var splitArr:Array = result.split(";");
me.sensorMax = this.lblMax = splitArr.substring(9,15);
me.sensorMin = this.lblMin = splitArr.substring(9,15);
//sensorUnit =lblUnit = splitArr.substring(6,25);
_root.sensorMax = me.sensorMax;
I also noticed that the init() function is nested in the openService() function in the posted code, is that right? Dunno if this is important, but I thought it should be a part of the class, not of a function in that class.
The trace displays the value received - which is great, except I can't seem to reference the Label - lblMax - on the stage, within the Sensor Component to the value received (sensorMax).
I was trying to have a paramater sensMax-sensorMax, and pass a value into that, and it reads it from there, but I cna't seem to do that.
If I also place a trace outside the .onResult function - after the closing brace, it calls that trace first and displays the paramate value, and not the value received. Is this due to the pendingcall? It waits for a value and proceeds?
I am really confused with this action script! hah
Thanks again for your help!!!
I did some debugging and it shows that sensorMax, sensorMin are being assigned to the values received in the paramater values....
This is great!!! Wow! haha
How do I now assigned the sensorMax,sensorMIn (component paramater values) to the Labels in the component?
Thank you soooo much!
Sorry for so many posts.
If I refer to sensorMax in the root level, it comes up undefined? Yet in my level0 instance it displays it as the value recevied?
this.lblMax must be me.lblMax too, I forgot to change it. Does that display the values?
oh my god! I love you! Haha
Thanks again Blemmo for your help! It worked!!
I have been trying to conquer the scoping for variables in AS!! Thank you!
One quick question before I stop bothering you!
When I try to tween this object:
myTween = new mx.transitions.Tween(object, object_property, easeType, begin, end, duration, frames_flag);
it says there is no property with 'myTween' yet I am defining myTween as a new mx.tranistions.Tween object? Do I define this as an object before I tween?
var myTween = new mx.transitions.Tween(...)
In AS 2, you have to define vars explicitely, I think.
Excellent, thanks again Blemmo, i really appreciate it!