How to access width and height variables of Flash application using getVariable:(Read 14007 times)
I need to resize an object in my container application based on the width and height of the contained Flash application. All I ever get from getVariable: call is a null object. For variable name I've tried numerous variations on "_root.width", "width", and others all to no avail.

Should I be able to access these variables? If so, how?



As far as I understand you refer to Flash'In'App.

This issue with getVariable occurs, because width and height are properties, not variables and in order to get them it is necessary to call TGetProperty functions as follows:

Code:
Code: [Select]
NSString *strWidth = [flashView invokeFunction:@"TGetProperty" withArguments:[NSArray arrayWithObjects:@"/", [NSNumber numberWithInt:8], nil] ];
As the result of the above code you will receive a sting with width value.

Thus, you call TGetProperty function with two arguments:

1) timeline - in your case it is root timeline;

2) property number for the property which you want to receive.

For more information about property numbers, please, visit:
http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_04.html#69558



Travis,

Thank you very much. The key was understanding that width and height are properties and that there is an ActionScript function TGetProperty.



 

Sitemap 1 2 3 4 5