PDA

View Full Version : communication between live-preview & the user interface


shunryusuzuki
01-16-2007, 01:05 PM
Re-Hello there!

I was wandering if there is a way to get the right variables from a live-previewed component.
I mean if you have a propertie set by default to 0 and you change it to 200, if you come back later on the component inspector all the value are reseted to their default value.

Exemple if my composent is a simple shape with x and y properties (default value 0) If I change those value and do something else and then come back to the properties inspector the x and y are reseted to 0 !!!

I write all the setter and getter I need in my class and put the right [inspectable] tag everywhere,.... so I'm prety confused.... what the hell is wrong with my component.

I tried to call the propertie in the interface but it's working only one way....

thanks for ANY help.

Simon

shunryusuzuki
01-17-2007, 09:27 PM
Maibee i gotta explain that a different way....

I have AS file for my class, and two embeded SWFs in my component and cause I'm realy newbie in making components I'm quite confused...

How the "communication" does work between the 3 SWFs (I mean the swf from the movie your creating with the component, one for the user interface and another for the live-preview wich is really really needed in this project...) ?

What I understand with this problem is that if the communication is easy in one way it isn't in the other way: I named the instance of the component xch in the live-preview so I can "take" the properties and variables from my interface and "put" them in the live-preview.... amazing no?(sorry I'm loozing my nerves :-s) ....


so that's working and I can even change thoses values in the interface and directly see what's append in the live-preview
... wow it's great!


var tx:mx.controls.NumericStepper;
var txListener:Object = new Object();
txListener.change = function(evt_obj:Object) {
xch.translateX = evt_obj.target.value;
};
tx.addEventListener("change", txListener);


so the "xch.prop1" is the right object but can someone explain me why in the same scope this isnt functioning:

tx.value = xch.translateX;


I first thought that is was due to my getters and setters but their are all OK.

So here is what I have to do:
My component cretate some 3d primitive you can modify directly on the stage throught the interface (classic 3d interface) and I want some function like this one so the interface when I open it will "reconize" the current state of my 3d object and not reset all of his value to 0....


function setValuesLikeTheyAreInTheLivePreviewPlease() {
tx.value = xch.translateX;
ty.value = xch.translateY;
tz.value = xch.translateZ;
rx.value = xch.rotateX;
ry.value = xch.rotateY;
rz.value = xch.rotateZ;
sx.value = xch.scaleX;
sy.value = xch.scaleY;
sz.value = xch.scaleZ;
}


the question is "why can I make my interface talk to my live preview and not the inverse?".

thats it!

ouf!

I hope I don't waste your time to much with this long long "serie B rose water roman" (=roman à l'eau de rose in french)

Simon.

<---------- here is the end