How can I move two figures on the stage with remote shared object?
Hi, I have a problem...
I need to move two figures on the stage with shared object like the "Tutorial shared Object ball" on the adobe website but with more than one figure. All the client must see the figures moving. The figure are a circle (Cerchio) and a square (Quadrato).
Help me, please. This is the script:
package
import flash.display.Sprite;
import flash.net.SharedObject;
import flash.events.NetStatusEvent;
import flash.events.SyncEvent;
import flash.net.NetConnection;
import flash.events.MouseEvent;
import flash.display.MovieClip
//import flash.net.ObjectEncoding;
public class BlocchiLogici extends Sprite
private var pointer_so:SharedObject;
private var pointer1_so:SharedObject;
private var nc:NetConnection;
private var good:Boolean;
private var Cerchio:cerchio;
private var Quadrato:quadrato;
private var Rettangolo:rettangolo;
private var Triangolo:triangolo;
public function BlocchiLogici()
//NetConnection.defaultObjectEncoding=flash.net.ObjectEncoding.AMF0;
//Connect
var rtmpNow:String="rtmp://192.168.1.66/BlocchiLogici";
nc=new NetConnection ;
nc.connect (rtmpNow);
nc.addEventListener (NetStatusEvent.NET_STATUS,doSO);
Cerchio=new cerchio ;
addChild (Cerchio);
Cerchio.x=50;
Cerchio.y=200;
Cerchio.addEventListener (MouseEvent.MOUSE_DOWN,beginDrag);
Cerchio.addEventListener (MouseEvent.MOUSE_UP,endDrag);
Quadrato=new quadrato ;
addChild (Quadrato);
Quadrato.x=100;
Quadrato.y=200;
Quadrato.addEventListener (MouseEvent.MOUSE_DOWN,beginDrag);
Quadrato.addEventListener (MouseEvent.MOUSE_UP,endDrag);
private function doSO (e:NetStatusEvent):void
good=e.info.code == "NetConnection.Connect.Success";
if (good)
//Shared object
pointer_so=SharedObject.getRemote("point",nc.uri,false);
pointer_so.connect (nc);
pointer_so.addEventListener (SyncEvent.SYNC,doUpdate);
private function doUpdate (se:SyncEvent):void
for (var cl:uint; cl < se.changeList.length; cl++)
trace(se.changeList[cl].code);
if (se.changeList[cl].code == "change")
if (Cerchio)
switch (se.changeList[cl].name)
case "xpos" :
Cerchio.x=pointer_so.data.xpos;
break;
case "ypos" :
Cerchio.y=pointer_so.data.ypos;
break;
else if (Quadrato)
switch (se.changeList[cl].name)
case "xpos" :
Quadrato.x=pointer_so.data.xpos;
break;
case "ypos" :
Quadrato.y=pointer_so.data.ypos;
break;
private function beginDrag (e:MouseEvent)
if (Cerchio)
Cerchio.addEventListener (MouseEvent.MOUSE_MOVE,moveMc);
Cerchio.startDrag ();
else if (Quadrato)
Quadrato.addEventListener (MouseEvent.MOUSE_MOVE,moveMc);
Quadrato.startDrag ();
private function endDrag (e:MouseEvent)
if (Cerchio)
Cerchio.stopDrag ();
else if (Quadrato)
Quadrato.stopDrag ();
private function moveMc (e:MouseEvent)
e.updateAfterEvent ();
if (Cerchio)
pointer_so.setProperty ("xpos",Cerchio.x);
pointer_so.setProperty ("ypos",Cerchio.y);
else if (Quadrato)
pointer_so.setProperty ("xpos",Quadrato.x);
pointer_so.setProperty ("ypos",Quadrato.y);
I need of a server side file?
Thanks.
I solved it!!
I duplicated the script....
It's work perfectly..
Emiliano.
Similar Messages
-
The iMovie main screen is hides somewhere off screen? How can I move it back to the middle?
jrod53, that is strange. Displays will always appear under the Hardware tier of the System Preferences. I've never seen it disappear, so I'm a little surprised. Do you have two monitors attached to your computer? It may be the Mac thinks there's two displays and it is send the window for iMovie out to secondary display which you don't have access to. Also is there one side of your display where the mouse will disappear off the edge of the screen, go into a black hole?
-
how can I make two copies of the same picture one with my watermark and one without for printing for clients?
Export the photo twice, once with a watermark and once without a watermark.
-
How can i add two values under the same property?
Hi all,
How can i add two values under the same property name in a
prop list? For example:
[question1: "item1","item2", question2: "item3","item4"]
To be more precise, i am creating a property list and I want
whenever a two values have the same property name to be added int
he list under the same property. For example:
gMyList.AddProp (#""&question&"" & x,
member("input").text)
question is a variable that is updated fromt he user's input.
Now, whenever somethign like this happens:
question = "question1"
member("input").text = "five"
question = "question1"
member("input").text = "six"
I want to output list to be:
[question1: "five","six"] and so on
Any ideas?Maybe you could make each property a list (so you have a
property list full
of lists), and add multiple values to the list held in a
particular
property?
Cheers
Richard Smith -
In Mail, my message preview used to be shown to the right side of the messages. Now it is showing below the messages. How can I move it back to the right?
Select the Viewing tab in the Mail preferences dialog and uncheck the box marked Use classic layout.
-
When I log onto a site, the material is over to the right too far. I lose data on the right side of the screen How can I move it more to the left.
This issue can be caused by the Babylon Toolbar 1.1.8 extension
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode -
My phone was stolen. How can I get my photos off the iCloud with Snow Leopard.
Welcome to the Apple Community
You can't, if the photos are in photostream you need a compatible device, if they are in a backup, you can only use the backup to restore to a new device. -
How can i make two ipods use the same apple id
How can I make two ipod touchs have the same apple id
If you haven't already set up your two iPods either make and apple I'd on one and on the setup on the other type on your apple ID by setup I mean when you first get it it asked you questions so when your done answering the questions your iPod is ready to be used
-
How can we restrict Key Figure in the BI System
Hi All,
Can any one explain How can i restrict key figures in BI system.
So when i create a query a specific user can only execute it if a specific key figure is a part of query otherwise he is not allowed to execute a query.
For Example:
A user TEST123 is allowed to execute a query with keyfigure Quantity he is not allowed to execute the query if any other key figure is present in the query
Regards,
DeepakHay Diogo,
Bravo...
Your suggetions always work for me. The scenario was that
A user TEST_PLD08 should only allow to see output for the querys which consist of the keyfigure PLDQUACMP and not for other keyfigures while other user TEST_PLD07 is allowed to see the output for querys consist of any of the keyfiguers.
so I have assign a authorization profile PLD_TEST07 to the user TEST_PLD08 with KeyFigures authorization as mentioned below and it is working fine
I EQ :
I EQ PLDQUACMP
You can forward me more scenarios like this if you can think of more it will be really helpful for me
Regards,
Deepak -
How do i move a sprite across the stage using the arrow keys on my keyboard?
I'm a high school student and i love director. I recently have become interested in game development, and i am completely lost in how to move a sprite across the stage. I have tried toying around and google hasn't been very helpful. An example of something i found is
on keyUp
if (_key.keyCode = 124) then sprite(4).locH = sprite(2).locH -25
if (_key.keyCode = 123) then sprite(4).locH = sprite(2).locH -25
end keyUp
I don't understand why this wont work.
HELPThis code moves sprite 2 to a position relative to sprite 4. If sprite 4 is not moving, then sprite 2 will always move to the same position, so it will not appear to move at all.
Perhaps this code makes more sense:
on keyUp
if (_key.keyCode = 124) then sprite(2).locH = sprite(2).locH +25
if (_key.keyCode = 123) then sprite(2).locH = sprite(2).locH -25
end keyUp -
Everytime I want to send a file to the trash, I have to either perform some kind of key combination/shortcut or use the trackpad/mouse, right click and select "move to trash", or drag the file(s) to the trash! This is absolutely ridiculous. Why can't I just press the delete button??? I cannot take it anymore! It's such a waste of time.
After some research, I finally found a post with the answer I was looking for from user par larsson
Re: How delete a file in mac os x?
"You can also go into System Preferences and make a new keyboard shortcut. I turned one of the function keys into a "Move To Trash" key.
1. No need to use the mouse for something that should be simple and quick.
2. Single button press just like in Windows."
Seriously!
Now the problem is how do you do this?
1. I went to the system prefs > Keyboard > Keyboard and checked "use F1, F2, etc... as standard function keys.."
2. Under keyboard shortcuts, I selected "Application Shortcuts" and clicked on the "+" sign
3. I selected the finder application, entered "Move To Trash" in the action box, and F12 as the key (because it's next to "delete")
That did not work. It just opened the dashboard instead.
4. I went back to "keyboard shortcuts" and found F12 was already assigned to open the dashboard. So I unchecked it and tried again.
That still didn't work. I would select the file to be moved to trash, press F12, and after an error "beep" sound, the last file in the folder was highlighted.Duuuuuuuuuuuuuuuuuuuuuuuude!!!!!!!!!!!! YOU DID IT! I cannot believe it!
I changed "Move To Trash" to "Move to Trash" and selected a file. I had lost all hope, so I took a minute to prepare myself for yet another moment of deep frustration. Then I pressed F10, and bang! the file was trashed!!! It took me a couple minutes to actually believe what just happened. Thank you so much! If I could, I would "like" you as many times as I can physically hit the "Liked" button!
PS: what the heck is wrong with Apple though??? Wrong instructions, incorrect help instructions on their own site. The chances of figuring this out before having a nervous breakdown were like one in a million (approximately, I did not actually do the math). Last week, the keyboard and the trackpad stopped responding on my brand new macbook pro for a couple hours. I was not the only one with this problem. Apparently, this was from a design flaw, which means it could happen again at any time. iMovie doesn't work. TextEdit keeps crashing all the time. Emptying the trash can take hours.
Since 2000, I bought a PMac G4 Quicksilver, a used PMac G3 Blue, a used iBook G4, a used Pismo PBook G3, a used Graphite iMac G4, a used iMac G3 (green, 233MHz I think) and I already had more problems with this brand new macbook pro than will all the other macs combined... For such an expensive machine, with 16GB of RAM, that's a little dissapointing, especially from Apple. Maybe I'm just not lucky.
Anyways, thanks again! Best moment of 2014! -
How can I have two pages in the same Oracle Drive Path?
I have been using OracleDrive for some time to publish a specific kind of document once every week.
Now I have on my front page a content area that show the newest 3 of these documents. However, I'd like to place a link at the bottom that says "Show All", and that should link to a page that shows all my items in this folder.
So basically I want to have two pages that are based on the same folder..
How can I achieve this behaviour?
Thanks,
BotzyGreetings,
When you say two monitors do you mean two separate computers (like 2 iMacs)?
If you mean 2 seperate macs then you could either:
Use a network keyboard / mouse sharing program like Teleport: http://www.macupdate.com/app/mac/14042/teleport
Use a physical KVM switch: http://www.belkin.com/IWCatProductPage.process?Product_Id=267031
Hope that helps. -
How can I produce two outputs of the same project
Dear Sir,
My aim is to produce two outputs of the same master project,
HTML help and Webhelp each one will be used differently in my
compnay.
Producing two outputs is fine but the problem was that
external links are done differently for HTML help and Webhelp and
as I Knew from you that this can be solved using conditional tags.
Actually I am new to conditional tags and I don't know how to
use them. Could you please help me to do this or recommend a link
on how to use condtional tags to produce different outputs.
Thank you very very muchHi there ahlam323
See if the link below helps any. Some goober wrote something
on it.
Click
here to read the goober's guide
Cheers... Rick -
How can I move/combine toolbars on the same line to gain more screen space ??
In IE you can lock or unlock toolbars and grag them and move to another line to gain more screen space & still have all you need up there.
How can I do this in Fire-fox ??You can only combine the content of several toolbars on one toolbar if the toolbars support that feature. If that is possible then you can do that via the View > Toolbars > Customize window or via the options of that toolbar (Tools > Add-ons > Extensions).
-
How can I connect two ipods on the same computer ?
Hello,
My girlfriend has just bought a ipod nano. I have already a "classic" ipod. Do you know how can I connect the two Ipod on the sasme computer without loosing all my songs ? Is ti possible to select songs that she will transfer ?
Thanks for your answerI am trying to contact a Nano to the same computer that has a Shuffle and Mini on it but it just doesn't want to update. I have been sitting fr about 3 hours now trying to make it work and cannot get anywhere. Can ANYONE help?
Thanks.
Do Apple not have an online help service? It seems a little strange for a company so large.
Maybe you are looking for
-
Lost all my playlists and some music - how to restore?
I'm running itunes on XP and when I booted iTunes today, all my playlists were missing and lots of music. I don't know of any major crashes or problems with my maching, but the music is gone from iTunes. I went to "mycomputer" and actually found all
-
I am unable to insert working links in my emails. What process should I use?
All efforts to include a website link fail. I use the link function, type in the website address and paste it in the email. However, recipients cannot use the link to open the connected website. What am I doing wrong? Thanks
-
My phone number is gone from imessages on my iphone
When I send and recieve messages on my iphone they do not go through my phone number instead they go through my email and my phone number doesn't even appear as an option anymore for imessages.
-
Manage two invoice posting for one price condition in sales document
Hello Experts, I am a new user in SD module especially for billing and pricing part, and i have a specific requirement from my client that i cannot find the solution. Could you please help if you have any idea to resolve the following situation: I ha
-
Autocomplete shortcuts not working after IO6 upgrade
I cannot get my shortcuts to work since upgrading to IOS6. Eg, Lc used to autocomplete to "luv, Carol x" Is there a way to fix it please?