| By Nima Azimi | Article Rating: |
|
| November 1, 2005 09:00 AM EST | Reads: |
33,762 |
In Director we create a global variable named "isMouseDown". Assign a behavior to the ball sprite and use this variable to determine if user clicks on the ball sprite (isMouseDown = true) or not (isMouseDown = False).
We use the "rect" property of the ball sprite to test its location and the stage boundaries. "rect" is an array that has 4 elements: the left, top, right and bottom coordinates of the sprite.
In Director:
on exitFrame
if sprite("Ball").rect[1] <= 0 then
sprite("Ball").LocH =
sprite("Ball").LocH + 50
end if
if sprite("Ball").rect[2] <= 0 then
sprite("Ball").LocV =
sprite("Ball").LocV + 50
end if
if sprite("Ball").rect[3] >=
640 then
sprite("Ball").LocH =
sprite("Ball").LocH - 50
end if
if sprite("Ball").rect[4] >=
480 then
sprite("Ball").LocV =
sprite("Ball").LocV - 50
end if
if isMouseDown then
ball_so.data.x = sprite("Ball").LocH
ball_so.data.y = sprite("Ball").LocV
end if
go to the frame
end
The complete listing of this sample is shown in Listings 3 to 5.
Now, you can publish the project and run two instance of it. Drag the ball sprite and see the effect in other running instance.
What's Next?
You've just experienced some of the basic concepts of using FlashCom in Director. But all of those samples are client-side only. When you learn how to use server-side scripting with Director to receive from and send messages to it, the power of your multi-user applications will increase greatly.
For example, with server-side scripting you can manage users and verify them to accept or reject their connection request, and so on. Using authentication, you could give different users different roles in the system, assigning some users more power in the system than others. For example, think of our chat system extended to include a teacher and several students. The teacher would have the ability to correct false information and push additional material that the students might not have. In a more game-like environment, a "Game Master" might have the ability to control the positions of objects that the individual players do not have the right to move. By exploring the capabilities of the Flash Communication Server, and its use in Director, several of these types of applications can be built using the shared object model.
Published November 1, 2005 Reads 33,762
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Nima Azimi
Nima Azimi is a software engineer, multimedia project manager,
consultant and programmer on variety projects. His projects include
educational "How does it works" titles for children education with
real-time 3D content. He has worked with Director for over four years,
and he currently teaches courses in Director programming and multimedia.
In his spare time he makes highly detailed photorealistic 3D scenes as a
3D artist and writes video game scripts and gameplay ideas that he
wishes to develop into full games at within the near future.
![]() |
Rob Sandie 11/01/05 03:03:15 PM EST | |||
Just a note: with the new release this month it will not be FlashComm or Flash Communication Server. The beta has it anounced as Flash Media Server 2. |
||||
![]() |
gamer4all 11/01/05 10:00:35 AM EST | |||
|| Using authentication, you could give different users different roles in the system, assigning some users more power in the system than others || I've tried this. It works real well. |
||||
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Adobe Flex Developer Earns $100K in New York City
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Ph.D. in Twitter Anyone?
- Eolas Sues the Internet
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Special Report on the Emerging Cloud Computing Trend
- Adobe Cans Another 9% of its Workforce
- My Thoughts on Ulitzer
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Ulitzer Live! New Media Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Executives Feature on Cloud Computing Expo Power Panel
- Software Flexibility in the Cloud - Part 4 of 5
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Where Are RIA Technologies Headed in 2008?
- Cover Story: How to Increase the Frame Rates of Your Flash Movies
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Your First Adobe Flex Application with a ColdFusion Backend
- Adobe Flex 2: Advanced DataGrid
- i-Technology Blog: Death-Knell For "Rich Media? Hardly!
- Adobe/Macromedia - Microsoft, Look Out!
- How To Create a Photo Slide Show ...
- Adobe Flex Interface Customization - Themes, Styles, Skins
- Personal Branding Checklist
- Has the Technology Bounceback Begun?
- "Real-World Flex" by Adobe's Christophe Coenraets





































