PDA

View Full Version : ExternalInterface advanced controls


martynrlee
12-04-2007, 02:23 PM
Hi Guys,

I am looking to find a way to create an incremental and decremental control for adjusting the autorotator speed using an external swf file embeded in a html page.

I am using the flash externalinterface control and have this set up to pass a single value to the pano. So I can currently create an external swf button that will set the autorotate to say a value of +2 and a button that will set a value of -2.

I can do this using the following code:



slow_btn.onPress = function () {
ExternalInterface.call("window.document['"+movieName+"']."+ExternalInterfaceID+"PanoExecute", "external.autorotator.speed=-2;");
}

fast_btn.onPress = function () {
ExternalInterface.call("window.document['"+movieName+"']."+ExternalInterfaceID+"PanoExecute", "external.autorotator.speed=2;");
}




My idea is to add a constant back to the speed value for plus and minus values. So basically.... on button press:


(external.autorotator.speed=(external.autorotator. speed + 1)


I can receive the current speed value by using the following panoget fuction:



onEnterFrame = function () {
speed = int(ExternalInterface.call("window.document['"+movieName+"']."+ExternalInterfaceID+"PanoGet", "external.autorotator.speed"));
}



I believe I can use something like the following code:



"external.autorotator.speed="+speed+"+"1");



However I believe I have the syntax totally wrong here..! as its not working.

Can anybody help me?? Any ideas...

All help most appreciated.

zleifr
12-04-2007, 09:43 PM
I think you have to get the speed (panoget), calculate the new speed and then set it, with I believe the panoset command, basically like the panoget one works...

martynrlee
12-05-2007, 01:03 PM
Thanks for your response Zleifr,

I understand that I need to receive the current autorotator speed using the panoget function and I can assign a single value to the current speed using the panoset function. So I could have a button that sets the speed to a value.

The problem that I am having is the syntax for calculating

external.autorotator.speed = (external.autorotator.speed) + (constant)


This is so that I can add buttons that increase and decrease the auto-rotate speed.

Any ideas?

zleifr
12-05-2007, 07:07 PM
I suppose I would do it like this:

speed = int(ExternalInterface.call("window.document['"+movieName+"']."+ExternalInterfaceID+"PanoGet", "external.autorotator.speed"));

speed += constant;

ExternalInterface.call("window.document['"+movieName+"']."+ExternalInterfaceID+"PanoSet", "external.autorotator.speed="+speed));

I think that should work, or some minor variation thereunto (ExternalInterface is not my thing, so I don't have a working code example to cut and paste from).

Hope that helps.

martynrlee
12-06-2007, 03:34 PM
Thats great help, cheers Zleifr!

I used two variables speedup and speeddown and added a constant to each of these using the technique you outlined in this thread, works well, thank you very much.

martynrlee
12-06-2007, 03:36 PM
Another question (sort of ) related:

Now that I have swf control objects (auto-rotate adjust speed) in my virtual tour environment, do you know of a way to reduce or alter the 'harsh' aliasing on the edges of objects?

zleifr
12-06-2007, 05:00 PM
If I remember correctly autorotator has a quality setting:
<autorotator>
quality = high
</autorotator>

Also
<parameters>
qualityMotion=high
</parameters>

Those might help, and maybe even completely fix it, but they might also really eat up a lot of processor power.