Flash ActionScript 2 Error

Place to post your creations and discuss them, attachments are currently limited to 512kb. Please notify administrator to post larger files.
pyspilf
Senior Member
Senior Member
Posts: 133
Joined: Wed Jul 09, 2008 5:35 am
Location: Madrid, Spain
Contact:

Flash ActionScript 2 Error

Postby pyspilf » Wed Apr 29, 2009 11:03 am

Guys,

I've been doing lots of reading on this forum about creating custom flash objects for use in ML, and have managed to get a dynamic text containing a value, like for example: _root.MLHSPlugin_]53_value

However, and I thought I understood this would work equally well in ActionScript, I get a syntax error for this statement.

var power = _root.MLHSPlugin_]53_value;

Can anyone understand why? Is is to do with the "]" symbol? Any idea how to get around this?

Thanks a lot!

Sandro
There is a thin line between exposure and visibility...

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Postby mcascio » Wed Apr 29, 2009 11:08 am

I would start there. Try using variables without the bracket and see how things go.
Mario Cascio
Cinemar, Inc.
http://www.cinemaronline.com

pyspilf
Senior Member
Senior Member
Posts: 133
Joined: Wed Jul 09, 2008 5:35 am
Location: Madrid, Spain
Contact:

Postby pyspilf » Thu Apr 30, 2009 1:22 am

Mario,

I have tried and I believe the issue is that ActionScript considers the ] symbol as a part of an array delimiter... I have found one workaround but it seems a bit cumbersome:

I assign the MLHS variable that contains the ] character to a dynamic text object, say myText, and then in ActionScript I use myText.text to retrieve the value... it works, BUT it would mean if I need to use 10 of these variables for example, I will need 10 hidden dynamic text objects to get the value. Doesn't seem very efficient, does it?

There must be another way to do this... I was hoping some Flash expert may have some suggestions. Unfortunately, these variables come from HomeSeer and I cannot change the ] character. It is a virtual device identifier assigned by HomeSeer and not available for the user to modify.

I suppose I could also create lots of shadow ML server variables with more ActionScript friendly names by copying all of the ones that come in via MLHS... again, a bit cumbersome.

Cheers

Sandro
There is a thin line between exposure and visibility...

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Postby mcascio » Thu Apr 30, 2009 6:02 am

Hi Sandro,

I know this has been an issue for other HS users. I know there is a workaround. I would search this forum and the HS/Mainlobby forum for the answer.
Mario Cascio

Cinemar, Inc.

http://www.cinemaronline.com

pyspilf
Senior Member
Senior Member
Posts: 133
Joined: Wed Jul 09, 2008 5:35 am
Location: Madrid, Spain
Contact:

Postby pyspilf » Thu Apr 30, 2009 6:55 am

Mario,

thanks for the suggestion. I searched this forum and could not find anything. I have cross-posted in the HS forum (http://board.homeseer.com/showthread.ph ... post869864) - maybe Krumpy or someone who has had this issue will pick it up

Cheers

Sandro
There is a thin line between exposure and visibility...

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Postby mcascio » Thu Apr 30, 2009 7:12 am

If I remember correctly, you would remove the current device using the ], then add another device as a placeholder to take that position. Then re-add your original device, so it uses the next character in HomeSeer's lineup.
Mario Cascio

Cinemar, Inc.

http://www.cinemaronline.com

pyspilf
Senior Member
Senior Member
Posts: 133
Joined: Wed Jul 09, 2008 5:35 am
Location: Madrid, Spain
Contact:

Postby pyspilf » Thu Apr 30, 2009 7:20 am

Mario,

I wish I could... I have tons of physical and virtual devices that use [, ], \, etc.... all the most code-unfriendly IDs!!!!! It would take forever to re-assign all the IDs

What a pain. But, apart from this, I am really enjoying ML and HS, and getting good value out of MLHS, so I am happy all the same :-)
There is a thin line between exposure and visibility...

User avatar
Krumpy
Developer
Developer
Posts: 1228
Joined: Thu Sep 04, 2003 10:17 pm
Location: Minneapolis, Mn
Contact:

Postby Krumpy » Fri May 01, 2009 1:49 am

New beta of MLHSPlugin that now can use device names in addition to x10 house/unit codes.

This will resolve your issue - hopefully - it's beta!

http://board.homeseer.com/showthread.php?t=135709

pyspilf
Senior Member
Senior Member
Posts: 133
Joined: Wed Jul 09, 2008 5:35 am
Location: Madrid, Spain
Contact:

Postby pyspilf » Fri May 01, 2009 4:59 am

Krumpy, thanks, this is much appreciated!!! I will give it a spin and let you know!

Cheers
There is a thin line between exposure and visibility...

wireless
Senior Member
Senior Member
Posts: 210
Joined: Wed Mar 24, 2004 10:44 am
Location: East Tennessee
Contact:

Postby wireless » Fri May 01, 2009 9:07 am

Can you actually use device names in a command? ex: ToggleDevoce:Foyer Lamp

Doesn't seem to work. MLServer log shows the command but HS doesn't


Return to “MLS files/Buttons/Icons/Backgrounds/SWF/3rd Party Apps/Device Files”

Who is online

Users browsing this forum: No registered users and 2 guests