Open Discussion on FLASH in Main Lobby

Tell others how you're using MainLobby.

Will you check back on this thread?

Yes.
19
68%
No.
1
4%
Maybe
8
29%
 
Total votes: 28

User avatar
camelotbuilder1
Newbie
Newbie
Posts: 8
Joined: Tue Jan 09, 2007 12:50 pm
Location: Sag Harbor NY
Contact:

Open Discussion on FLASH in Main Lobby

Postby camelotbuilder1 » Tue Jan 16, 2007 4:26 pm

Hello all, my name is Moses.
I'm a home automations installer on the east end of long island NY.
I have designed and allmost succesfully installed a home automation system in a 6-7 million dollar home in the hamptons, based entirely on Main Lobby.
LOVE IT
(see my signature for a list of hardware i use)
I'm pretty new to main lobby and a little newer to flash.(8Pro)

I've seen many topics out there on the forum touching the subject but I'd like to get as much info in one thread as possible.

With that out of the way I'd like to start a discussion about FLASH and Main Lobby together.

If youve looked you've probably heard
thats its really easy....
_root something or other...

thats most of what i found

Just for fun i've imported huge elaborite entire flash sites into MainLobby only to find more broken than i could have imagined.
not like i expected it to work though it would have been nice.

After more phone calls to Mario than should be allowed... he told me this
(thanx for all your time and help mario)
it all started here.

To display a MLServe variable in text format in an swf imported into MainLobby Client.

In Flash
Make a dynamic text feild
in the Var box in the properties window put this code
_root.variable to be called
litteraly _root._currentscene
Publish your swf and import into Main Lobby by making a button and then in the properties window browsing for your swf in the JPG and SWF feild.

Presto! It works. variable called and loaded into my very own swf!
This will certianly help to make my stock ticker tick.

First thing I noticed is that MainLobby ignores the back ground color of my swf.
Not such a big problem but if you want a back ground for your swf place it as an object.

then I went a little further and tried to set/change the variable i was displaying in my swf.
In Flash
just below my dynamic text box i inserted 2 new symbols of the button type.
treat em like any other buttons in flash.
over down up states. have fun.
then just like i'd insert code for any other button...
on press..... but after that you want to send a MLServe set variable command. so heres what worked.
on (press) {_root.client.MLServerSocket.send("MLServeCmd.SetVariable|ok~yes");
}

this creates a new variable called ok and sets its value to yes.
if your Dynamic text box was loading variable "ok" youd see "yes" displayen in your text area
(after publishing and importing into Main Lobby) the fastest way i've found to do this is save your flash .fla file in the required mainlobby folder so when you preview your swf it saves the updated swf in the required MainLobby folder then all you need to do in main lobby is click edit, bring up the properties for the imported swf and without changing anything click ok and MainLobby should update your swf.

After placing 2 button symbols below my dynamic text feild(text feild with _root.ok in the var box) and scripting
on (press) {_root.client.MLServerSocket.send("MLServeCmd.SetVariable|ok~yes");
}
for one button and
on (press) {_root.client.MLServerSocket.send("MLServeCmd.SetVariable|ok~no");
}
for the other. yes and no respectively.
I imported my new swf into MainLobby and was Plesantly surprised to find that not only did main lobby immediately load the variable i wanted into the text feild but it also updated automatically when my buttons actually worked at setting MLServe variable "ok" to "yes" and "no"
STOKED

i figured you could keep your flash programming to a minimum by using Flash to trigger macro commands in MLServer.

what else have I found?

seems to me that all the stop, goto and play, motion, and tween functions move from Flash to Main Lobby pretty well.
COOL
you can apply states to your imported swf just like any button.
COOL
Masking is essential
Main Lobby displays anything off the stage in your swf, so...
mask anything you dont want to see in mainlobby, but...
dynamic text doesnt mask very well or at all for that matter, so...
to deal with masking off stage text i've added shape objects that match my Main Lobby bg color to mask off stage text, but...
this becomes immediately visable when you tint the states of your swf.
NOT SO COOL

WHY DO ALL THIS WHEN MAIN LOBBY IS SO GREAT RIGHT OUT OF THE BOX.

Main lobby is great out of the box
i plugged things in and watched them work, how cool is that.

but i've done some programming in a Flash hack program called swish so i knew that sliding layers and flash content are gooey and people like it.

i'm currently experimenting with a 3D rotatable cube with 6 different mainlobby macros attached to it, one per side.
goin is slow as i'm very new to actual flash.

My goal is to eventually create the entire front end of my automation system in a single flash file (swf) and load it into mainlobby wall to wall carpeting style.
like a flash web site for your house.

then the imagination can go where it wants to.

but there are HUGE holes in my knowledge that need to be filled in before that'll be possible.

Like...
Loading MLServe variables into Actionscript? not just the text feilds.
using XML to change the properties of the swf in MainLobby?
Linking to an external PHP file? maybe?(i've seen it done with xml in mainlobby)
etc...

A FEW QUESTIONS...

Does anyone know how to make different button states become active(up, over, down) depending on a MLServe variable?

Can any one help loading a MLServe variable into actionscript, dynamic buttons for instance.
on (press) {
gotoAndPlay("MLServe Variable");
}

Anyone understand how MainLobby loads fonts from an swf?



well thats it for now. have fun with that. i hope it helps. i'm gonna try to put everything i find and get into this thread.

I'd be willing to post the files (fla+swf) for what works so far if anyones interested.

TO ME MAINLOBBY AND FLASH WERE MEANT TO BE LIKE CHOCOLATE AND ICE CREAM.

Thanx
Moses, Camelot Home Automation
Last edited by camelotbuilder1 on Tue Jan 16, 2007 5:23 pm, edited 3 times in total.
Russound CAV6.6; ST2, VideoStorm 8x8, GC100, Yamaha 5890, HP MCPC, Touchtronix RADio touch screens; UTMA touch screen(geffen version), ELK M1 Gold, 4 Wireless routers, Linksys SRW248G4, IPort, Xanatech IR, RadioRA, HP Itronix mil-spec tablet.

User avatar
camelotbuilder1
Newbie
Newbie
Posts: 8
Joined: Tue Jan 09, 2007 12:50 pm
Location: Sag Harbor NY
Contact:

please move this post rather than deleting,

Postby camelotbuilder1 » Tue Jan 16, 2007 4:32 pm

there maybe other places to put this post but this is what i'm dong with main lobby
also please vote so i know how many people are actually interested in the thread.
if no one cares i'll take my time spent posting and program with it.
Russound CAV6.6; ST2, VideoStorm 8x8, GC100, Yamaha 5890, HP MCPC, Touchtronix RADio touch screens; UTMA touch screen(geffen version), ELK M1 Gold, 4 Wireless routers, Linksys SRW248G4, IPort, Xanatech IR, RadioRA, HP Itronix mil-spec tablet.

User avatar
camelotbuilder1
Newbie
Newbie
Posts: 8
Joined: Tue Jan 09, 2007 12:50 pm
Location: Sag Harbor NY
Contact:

sending macro commands from SWF

Postby camelotbuilder1 » Wed Jan 17, 2007 12:11 am

action script code for sending macro command to MLServer

on (press) {_root.client.MLServerSocket.send("MACRO NAME");
}

literal example

on (press) {_root.client.MLServerSocket.send("ChangeScene.Weather");
}

action script for calling a MLServe variable in actionscript.(answered my own question)

on (release) {
gotoAndPlay(_root.variable name);
}

literal example

on (release) {
gotoAndPlay(_root.framenumber);
}
Last edited by camelotbuilder1 on Wed Jan 17, 2007 9:19 pm, edited 2 times in total.
Russound CAV6.6; ST2, VideoStorm 8x8, GC100, Yamaha 5890, HP MCPC, Touchtronix RADio touch screens; UTMA touch screen(geffen version), ELK M1 Gold, 4 Wireless routers, Linksys SRW248G4, IPort, Xanatech IR, RadioRA, HP Itronix mil-spec tablet.

User avatar
rpalori
Member
Member
Posts: 82
Joined: Thu Jan 27, 2005 10:13 pm
Location: Houston, TX
Contact:

Postby rpalori » Wed Jan 17, 2007 12:48 am

I'm listening to you!

I dont know much about flash, but I am interested in what your saying. Hopefully someone with higher flash knowledge will post on this topic.

Glad you started the new post :)

You have my vote to keep this going

User avatar
camelotbuilder1
Newbie
Newbie
Posts: 8
Joined: Tue Jan 09, 2007 12:50 pm
Location: Sag Harbor NY
Contact:

Postby camelotbuilder1 » Wed Jan 17, 2007 4:14 pm

the big question is how would one use the mlserverconnect.swf found in the cinemar folder to make flash connect to MLServer without using main lobby client?
Russound CAV6.6; ST2, VideoStorm 8x8, GC100, Yamaha 5890, HP MCPC, Touchtronix RADio touch screens; UTMA touch screen(geffen version), ELK M1 Gold, 4 Wireless routers, Linksys SRW248G4, IPort, Xanatech IR, RadioRA, HP Itronix mil-spec tablet.

User avatar
lathanm
Intermediate
Intermediate
Posts: 372
Joined: Mon Feb 27, 2006 2:27 pm
Location: Aurora, IL
Contact:

Postby lathanm » Fri Jan 19, 2007 5:37 pm

subscribed

I am not the greatest with Flash but I will be watching your progress closely.
Hacker /n./ One who enjoys the intellectual challenge of creatively overcoming or circumventing limitations.

Pass the popcorn, the movie is starting!

http://project2501.tzo.com/gallery/automation
http://project2501.tumblr.com

cpetro
Newbie
Newbie
Posts: 15
Joined: Mon Mar 20, 2006 12:44 am
Contact:

Flash and Mainlobby

Postby cpetro » Fri Jan 19, 2007 9:46 pm

Flash definately is great for taking Mainlobby to the next level. Here are some things that I have done that I haven't seen mentioned.

When I had the 30 day trial of Flash I made some drop down menus but I was concerned that if my setup changed I wouldn't be able to use them anymore. To solve this I used a text file to hold the variables for the text in the drop boxes and for the MLServe Cmd to execute when the button was pressed. Now if I wanted to change anything all I have to do is edit the text file. This is good for a .swf that needs to go on multiple clients or be installed for different customers and needs to be configured differently. This is the same as the way you configure a Mainlobby .ini file.

open notepad and enter in values in this format:
&variable1=value1&variable2=value2&variable3=value3&
Save the text file ----MyText.txt
In flash on your actionscript layer create a new keyframe on frame 1 and use loadVariables to point to the text file that holds the variables.
Set up your dynamic text boxes to display the variables
Export your movie
The swf you just created and the accompanying text file have to be in the same folder to work. To work in Mainlobby they have to be in the Cinemar folder.

Here is another
To send a flash variable to Mainlobby use this syntax:

on (release) {
_root.client.MLServerSocket.send("MLServeCmd.SetVariable|mainlobby_variable~", flash_variable);
}

Just replace the mainlobby_variable with your variable you want to set in MLServer, and flash_variable with the variable used in your swf.

Why would you want to send a Flash variable to Mainlobby when you can set it in Mainlobby directly? Because Flash is more flexible, here is an example from a keyboard I made.

Currently there is no ML keyboard for touchscreens. Users can create their own in ML with buttons from A to Z that add that letter to a variable. Similar to the password protected example scenes. But, if you screw up you have to set the variable to nothing and start over. There is a definite need for the ability to backspace. In Flash you can do this.

Create your flash keyboard, buttons for each letter and a textfield bar at the top. Set the textfield up as dynamic and name it textfield.
Each button A thru Z adds to the textfield variable:

on (release) {
textfield = textfield+"A";
}

Create a backspace button and script it:

on (release) {
textfield = textfield.substr( 0, textfield.length-1 );
}

Create an Enter button and script it:

on (release) {
_root.client.MLServerSocket.send("MLServeCmd.SetVariable|message~", textfield);
}

When you type you are storing the text in the swf variables. This way MLServer doesn't get any info until you send it. This keeps the text under the swf's control to manipulate it. Backspace sets the variable textfield to itself minus the last character. Can't do this in ML directly, although I think others have used MLStringFunctions to do the same.
Now when you press enter it sends the textfield text to the MLServer variable message.
I use this for leaving messages for other household members. Much less annoying when you can simply backspace instead of erase when you have typed a long message.

Hope these examples can spark others Flash creativity.
Im not a Flash expert, this is all stuff I have figured out through trial and error. Please post if anyone can provide other details, it would be great to learn more.

Chris

User avatar
camelotbuilder1
Newbie
Newbie
Posts: 8
Joined: Tue Jan 09, 2007 12:50 pm
Location: Sag Harbor NY
Contact:

Postby camelotbuilder1 » Sun Jan 21, 2007 2:33 pm

wow thats really helpfull
any chance youd post the fla for that keyboard?

Has anyone been able to get around the nesting problem i seem to be having?

this is a tutorial swf/fla from the adobe site
http://www.thunderhammer.com/Nesting.swf
http://www.thunderhammer.com/Nesting.fla
this works fine in the flash player but looses all functionality in MainLobby
it could be the way mainlobby plays back swf's(there seems to be a gotoframe2 command in the mainlobby editor window, wish i knew what that did) or i think its because mainlobby deals with everything in the _root so other levels arent recognized...?


plus heres a fun little something i found...
place a button, center it and replace it with this swf
http://www.thunderhammer.com/crab_creatures.zip

could be used as an overlayFX so you could use a button to set it to visable or not

enjoy
Russound CAV6.6; ST2, VideoStorm 8x8, GC100, Yamaha 5890, HP MCPC, Touchtronix RADio touch screens; UTMA touch screen(geffen version), ELK M1 Gold, 4 Wireless routers, Linksys SRW248G4, IPort, Xanatech IR, RadioRA, HP Itronix mil-spec tablet.

User avatar
DavidL
Simply Incredible
Simply Incredible
Posts: 11071
Joined: Sat Feb 08, 2003 9:39 am
Location: Metamora, Michigan
Contact:

Postby DavidL » Sun Jan 21, 2007 4:58 pm

camelotbuilder,
MainLobby is the "root". something playing in MainLobby that references "root" is referencing a layer higher than what it is expecting.
Change the fla to use _parent (could be one or more layers) to target a particular layer instead.

User avatar
camelotbuilder1
Newbie
Newbie
Posts: 8
Joined: Tue Jan 09, 2007 12:50 pm
Location: Sag Harbor NY
Contact:

Postby camelotbuilder1 » Sun Jan 21, 2007 8:11 pm

that worked wonderfully
thank you
Russound CAV6.6; ST2, VideoStorm 8x8, GC100, Yamaha 5890, HP MCPC, Touchtronix RADio touch screens; UTMA touch screen(geffen version), ELK M1 Gold, 4 Wireless routers, Linksys SRW248G4, IPort, Xanatech IR, RadioRA, HP Itronix mil-spec tablet.

User avatar
VinceC
Member
Member
Posts: 77
Joined: Fri Oct 08, 2004 8:25 am
Contact:

Postby VinceC » Sat Feb 10, 2007 1:07 pm

Thanks camelotbuilder1,

Your tips have been extremely helpful in understanding Flash to ML Integration. I am now able to send MLServer commands from my Flash and show status of MLServer variables in my movieclips. This is working great!


One more quick question... Some of the ML Plugins use the 'LABEL' field of the button to send parameters into the SWF (for example in Library 19 you are able to set the resolution of the flash video stream by setting a label.).

How do I access the Mainlobby applied label in an SWF that i've imported to the ML scene?


Return to “How are you using MainLobby?”

Who is online

Users browsing this forum: No registered users and 1 guest