HELP - Rotating The World
First, here is a link to the work in progress: http://www.rson5.com/globeThe effect I would like to achieve is when the head of the pin is clicked, the globe rotates so that the pinhead is in the middle of the stage. I have been trying for hours trying to figure out the calculation for getting the globe's rotation relative to the pin's position. Source is below. Done in Papervision 1.5.Any help would be much appreciated.Code: package { import flash.display.*; import flash.events.Event; import flash.events.MouseEvent; import flash.text.*; import fl.transitions.Tween; import fl.transitions.easing.Strong; // Import Papervision3D import org.papervision3d.Papervision3D; import org.papervision3d.scenes.InteractiveScene3D; import org.papervision3d.events.InteractiveScene3DEvent; import org.papervision3d.cameras.Camera3D; import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.objects.Plane; import org.papervision3d.objects.Sphere; import org.papervision3d.objects.Cylinder; import org.papervision3d.materials.MovieAssetMaterial; import org.papervision3d.materials.InteractiveColorMaterial; public class main extends MovieClip { var container :Sprite; var scene :InteractiveScene3D; var camera :Camera3D; var line :Cylinder; var txtBox :TextField; var location_mc :MovieClip; var mouseDownX=0; var mouseDownY=0; var xDiff=0; var yDiff=0; var mouseIsDown:Boolean=false; var radius:Number = 500; var ax :Number; var ay :Number; public function main() { init3D(); stage.addEventListener(MouseEvent.MOUSE_DOWN,mousePressed); stage.addEventListener(MouseEvent.MOUSE_UP,mouseReleased); stage.addEventListener(Event.ENTER_FRAME,loop3D); } private function init3D():void { container = new Sprite(); addChild( container ); container.x = 500; container.y = 350; container.buttonMode = true; scene = new InteractiveScene3D( container ); ism = scene.interactiveSceneManager; camera = new Camera3D(); camera.zoom = 4; addWorld(); addPins(); } private function addWorld():void { var materialEarth :MovieAssetMaterial = new MovieAssetMaterial( "world" ); materialEarth.smooth = true; ballPivot=new DisplayObject3D ; scene.addChild(ballPivot); ball=new Sphere(materialEarth,radius,30,30); ballPivot.addChild(ball); } private function addPins():void { var materialSpace :InteractiveColorMaterial = new InteractiveColorMaterial( 0xFFFFFF ); var total:int = 4; var rad :Number = radius; for (var i:int = 0; i < total; i++) { pinContainer = new DisplayObject3D; var line:Cylinder = new Cylinder( materialSpace, 1, 250, 10, 5 );//elongated cylinder acts as the pin var lineEnd:Sphere = new Sphere( materialSpace, 15, 15,15 );//small sphere acts as the head of the pin lineEnd.name = "pin_" + (i+1); lineEnd.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, handleMainHover); lineEnd.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, handleMainClick); pinContainer.addChild(line); pinContainer.addChild(lineEnd); ax = -100 * (i+1);//static positions for the pins temporarily ay = 100 * (i+1); line.y = rad; lineEnd.y = rad+125; pinContainer.rotationX = ax; pinContainer.rotationZ = ay; txtBox = new TextField(); txtBox.name = "location_" + (i+1); txtBox.x = 25; txtBox.y = 30 *(i+1); txtBox.text = lineEnd.name; txtBox.textColor = 0xffffff; txtBox.antiAliasType = true; location_mc = new MovieClip(); location_mc.addChild(txtBox); location_mc.name = "port_" + (i+1); location_mc.addEventListener(MouseEvent.MOUSE_UP,gotoLoc); ball.addChild(pinContainer); stage.addChild(location_mc); } } private function loop3D(event:Event):void { if (mouseIsDown) { var currentX=mouseX; var currentY=mouseY; if (Math.abs(mouseDownX - currentX) > 1) { xDiff=(mouseDownX - currentX)/4; } yDiff=(mouseDownY - currentY)/4; } ball.rotationY+= xDiff; ballPivot.rotationX-= yDiff; ballPivot.rotationX=Math.min(60,ballPivot.rotationX); ballPivot.rotationX=Math.max(-60,ballPivot.rotationX); xDiff*= .5; yDiff*= .5; mouseDownX=mouseX; mouseDownY=mouseY; scene.renderCamera( camera ); } function mousePressed(event:Event):void { mouseIsDown=true; } function mouseReleased(event:Event):void { mouseIsDown=false; } function handleMainHover(e:InteractiveScene3DEvent):void { trace(e.target.name); } function gotoLoc(e:Event):void { trace(e.currentTarget.name); } function handleMainClick(e:InteractiveScene3DEvent):void { trace(e.target.name); } }}
Actionscript 3.0
Posted on: Mon Sep 08, 2008 2:25 pm
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[F8] Replacing Scrolling Icons To Rotating World Icons
Hi,
I'm working on this web site that needs to be changed. What I want to do is replace the scroll menu with a rotting world menu. Kinda like Itunes has in the album view.
I have a function called mover that makes the scroll menu move. So what I was thinking was that all I have to do is adjust that function.
This is roating world that I want to add:
Code:
function mover(count){
if(inited){
world.rotateY(360- ((360/15) * id), 8);
}
}
and this is the old scrollling menu
Code:
function mover()
{
if(_ymouse > 250 && _ymouse < 365)
{
var xdist = _xmouse - Stage.width/2;
this._x -= xdist / 25;
}
else
{
if(_xmouse > centerX)
{
this._x -= speed;
}
else
{
this._x += speed;
}
}
if (this._x>= -600)
{
this._x = -1500;
}
if (this._x<= -1501)
{
this._x = -601;
}
}
My question is why can't I just call the new function mover so that it grabs that information now?
Thanks in advance,
Bmcc
Rotating Boxes-non-rotating Box/text
i have a rotating menu(boxes in circular motion). when a box is rolled over, all stop, but the text box that should appear in the middle between them, is not appearing where it should. it seems to be following the animation of its parent box.....any ideas?
jas
Moon Rotating Around Rotating Earth
I've got my earth revolving around the sun. I can't get the moon to revolve around the earth while it is revolving around the sun. Has anyone done this before, or is willing to help out?
Thanks
Rotating Menu With Non-Rotating Labels
I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image the help explain what I am trying to do. Anyone know of an action script that would keep the labels upright?
How In The World Can I Do This?
ok i made my little tank game moves perfect hittests work perfect tank shoots heres my problem!!yeah the tank shoots but when you hit the left or righ arrow and the tank faces that direction you press, and then shoot it comes out the side of the tank! my question is how in the world and i going to make the tank shoot in the direction your facing??
thanks
How In The World Can I Do It?
How can I make a button open an application like Powerpoint (yuk) from a Flash button. I would need to open the presentation not from within a browser but from the applcation itself. Please help.!!
World Map
My name is Raghu Raman. I am given an assignment by my boss to develop a world map in flash and color the countries in the map according to the database values. For example if population is the area of interest and green is the chosen color, I need to show the most populous countries in darkest green and least ones with lightest green. How shall i proceed. Please do help me.
How In The World? Never Seen This Before
If you go to http://devlab.swift3d.com ... and click on one of the navigation links, it will pop up a window, click again and it does this cool "SHAKE RESIZE WINDOW" thingy.
How was that possible?
What In The World?
Hi all,
I apologize if this post is in the wrong place. I took a guess as to where to put it.
Here's the deal:
I created a site for my employer:
http://www.demonstratives.com
If you can see all the text, and all the files, load/play GREAT!
(you can tell if they don't)
There is a person @ work who can't see the text. It's like it doesn't load. Some of the swf files don't load in either.
If it matters, the text (on the left) is dynamic and read in from external txt files.
This person is running XP/I.E.6/ and has the flash 6 plugin.
Has anyone ever heard of this? I have no idea what is going on.
Thank you for your time!
How In The World Can I
how in the world can i make one of those audio things that show the diffrent pitches of sound. like the thing to the left of the jupiter plugin text. i dont know what its called, but i want to know how i can go about learning how to make 1
Pan The World
I am in need of some code that will move a movieClip up and down smoothly, with the use of a up, down, and slider button. The catch is it needs to work with a flash 5 Player. I have been looking for a tutorial all day and have become extremly pist. I recall my teacher showing me a way to use a percentage of the slider bar and the sliders Y value, but that was 2 years ago and my examples are long gone.
If anyone knows were a tutorial is or has an example file I could use the help.
Thank You
gartmann
Around The World
Hi folks
Just joined - great site.
Brief background: After a life in printing both traditional and dtp am making the logical step into web design (silly bugger aren't I). Anyway to cut a long story short, have been asked to do a revolving world with the company's name appearing to revolve anti-clockwise around the equator. Does anybody know the best way to do this. I can't believe it hasn't been done before so before I spend ages on laborious animation is there a quick way to do this. Don't be afraid to call me a lazy sod.
Yours in anticipation
Gary
I Beg You For The World
yo i hope your going good
if im gonna make a maze i want the walls so you cant go through them, im using the script to move the thing (ball tihng that shows you were you are in the maze) im using [code]onClipEvent (load) {
// Choose a movespeed
moveSpeed = 20;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (_root.Walls.hitTest(getBounds(_root).xMax, _y, true)) {
} else {
this._x += moveSpeed;
}
// Move Right
} else if (Key.isDown(Key.UP)) {
if (_root.Walls.hitTest(_x, getBounds(_root).yMin, true)) {
} else {
this._y -= moveSpeed;
}
// Move Up
} else if (Key.isDown(Key.DOWN)) {
if (_root.Walls.hitTest(_x, getBounds(_root).yMax, true)) {
} else {
this._y += moveSpeed;
}
// Move Down
} else if (Key.isDown(Key.LEFT)) {
if (_root.Walls.hitTest(getBounds(_root).xMin, _y, true)) {
} else {
this._x -= moveSpeed;
}
// Move Left
}
}
onClipEvent (enterFrame) {
if (_root.player._x > 500) {
this._x -= 10;
tellTarget ("_root.walls") {
_x -= 10;
}
}
if (_root.player._x < 50) {
this._x += 10;
tellTarget ("_root.walls") {
_x += 10;
}
}
if (_root.player._y > 350) {
this._y -= 10;
tellTarget ("_root.walls") {
_y -= 10;
}
}
if (_root.player._y < 50) {
this._y += 10;
tellTarget ("_root.walls") {
_y += 10;
}
}
}[code]
so if i want the walls so you cant move through them what code should i use on the walls of the maze?
How In The World?
This is an incredible site. Does anyone know how they do this? Got to http://xenao.com/
Click on contact. Type in "a/any"name in the name field and click submit. It checks for blank fields then goes back to the form and retains your name. Also, how do they do the word wrap in the "message" section? Whew. Thanks alot...
What In The World?
Alright this is really weird. I have a site I'm working on (before you ask, I'm sorry but no, I'm not able to allow you to see it) and there's a bunch of pages, each of which has the same preloader. And by same I mean a direct copy and paste from one to the next.
On every page but one it works exactly like you would expect. The code is:
(frame 1)
Code:
percent = Math.floor((this.getBytesLoaded() / this.getBytesTotal())*100);
percentText = percent + "%";
totalStuff = this.getBytesTotal();
(frame 5)
Code:
if(percent < 100)
gotoAndPlay(1);
percentText and totalStuff feed in to a dynamic textbox on the stage.
Same with every file, mind you. What happens is all the other pages show whatever they have loaded. But, on one of the pages it stays blank for a few minutes (the page is 4ish mb... the others rang from a couple hundred kilobytes to more than 9mb) then quickly jumps to 90 some then to 100.
I do not believe it is the code or the preloader, but actually something with Flash. There are a bunch of .jpgs and .pngs that I imported in to the errorenous file.
Ive also put a distinguishing mark on the first frame on the stage so that I know if it's actually there. This mark, like the rest of the file, does not appear on the stage until it's 90% loaded.
It's like the preloader isn't being loaded first, so the user waits with no indication of what is happening. There's nothing but 2 text fields to load on the preloader... so its not like there is an enormous background image to load or anything. The preloader is definately the first scene, and I have the load order the same for each file (bottom up... although top down didnt make any difference for me).
I'm completely out of ideas. I must somehow be able to tell it to load the preloader first. Any clue what's going on here?
The Whole World Is Mad About XML, Why?
Hi,
I've created a simple database program that stores the data in a .txt file. It works well and loads/saves fast. I'm thinking of expanding this program, but whats holding me up is that i'm not sure if I should convert everything over to use XML.
So my question is, should I do that? what are the advantages over using a .txt file for a database. Is using XML just a fashion?
thanks for any advice.
boombanguk
The Whole World Is Mad About XML, Why?
Hi,
I've created a simple database program that stores the data in a .txt file. It works well and loads/saves fast. I'm thinking of expanding this program, but whats holding me up is that i'm not sure if I should convert everything over to use XML.
So my question is, should I do that? what are the advantages over using a .txt file for a database?. Is using XML just a fashion?
thanks for any advice. (sorry about re posting this!, but I need to start!)
World Map
Hi there,
does anybody have template *swf of world map with country borders? If yes send please to my email bigmad@bigmad.net .
How In The World Do I Do This?
Hi,
I'm having trouble figuring out how to do something. I have a main swf file with multiple layers. One has a container movieclip called "bgContainer" (that's the instance name) and another layer has a container movieclip called "playerContainer".
Then I load another swf, background.swf, into bgContainer.
Now the problem. background.swf has movieclips in the library (e.g. "tree" (that's the linkage identifier for exporting)). I want to attach "tree"s to the main movie's playerContainer. Because I want the player to be able to walk in front of or behind the trees (depending on the depth of a tree vs. the depth of the player's image).
Unfortunately, someone told me that you cannot attach library items to a .swf movie other than the .swf that includes the library items. Meaning I can't attach the background library trees to the main movie. Is this so? Why would Flash be so stupid? And if true, then how could I simulate what I want to do above?
Thanks for any ideas.
Cfc Hello World ;;
Hi.. ive done some small apps with flash mx 2004 using cfcs to update/delete/edit dbs.. and ive just recently got flash 8.. im trying to just get a hello world to work and i cant even manage that.. ive looked around for nearly week for tutorials/working exmaples.. and i cant find anything ;;
the best ive found has been in the help files.. so ive tried to alter it.. But im not the best at programming by any means and i dont understand the help info they give
i have the feeling that im completely wrong.. if anyone could help i would be eternally gratefuly..
can someone tell me point me the right direction..
cfc :
</cffunction>
<!--- function to tes connection --->
<cffunction name="sayHello" access="remote">
<cfreturn "Hello World">
</cffunction>
flash 8 : edited from help files
import mx.remoting.Service;
// import Service class
import mx.rpc.FaultEvent;
// import FaultEvent class
import mx.remoting.PendingCall;
// import PendingCall clsas
import mx.rpc.ResultEvent;
// import ResultEvent class
import mx.rpc.RelayResponder;
// import RelayResponder class
mx.remoting.debug.NetDebug.initialize();
custService = new Service("http://localhost:8300/flashservices/gateway", null, "survey", null, null);
// connect to remote service
var pc:PendingCall = myService.sayHello();
// call service method
pc.responder = new RelayResponder(this, "getData_Result", "getData_Fault");
trace("no response from server yet.");
function getData_Result(re:ResultEvent):Void {
// receive result
trace(result);
}
function getData_Fault(fe:FaultEvent):Void {
// receive fault
trace("got the response");
}
thanks for any help
Stephen
How In The World Do You Do This?
I'm trying to bring in external text in the form of paragraphs and titles. I want to create text boxes for the paragraphs that fit exactly to the number of lines the paragraph will require. I want to do this so when I place them in a vertical line I can space them evenly.
If I just create a text box a certain size and the text only ends up being 1 line and the text box I created allows for 3 lines then the space between the paragraphs with less than 3 lines is much greater. Is there a way to create a text box based on your text and not size?
Thanks
Hello World
I am very new to Flash. I have about a week of experience. I would like to know how to create a function library.
I put the following code into a standard text file named mylib.as
function helloworld()
{
trace("hello world");
}
created a new flash project named test.fla
code in frame 1 layer 1
#include "mylib.as"
helloworld();
wow. it works. However, what is the preferred method of sharing code across flash .fla and .swf files?? How do I create my own function libraries and include them in my .fla projects??
Thanks
Hello World Help
I am a newbie to Flash Media Development Server 3, on Vista, trying to get the Hello World sample to work.
When I follow the instructions and place the Hello World folder in the applications folder and try to test the movie, I get a "read only" error. I have used the publish settings to make sure the default paths are used. I read about MS file folder permissions using cmd prompt ATTRIB, but discovered if I place the Hello World folder on my desktop I don't get the "read only" error.
I'm seeing the connect button, when I publish to html, but when I hit the button I just get the disconnect button, and no "Hello World".
I have the .as, .fla, .swf files on my desktop Hello World folder, and the .asc in the applications/Hello World folder.
Could someone give me some advice on how to get Hello World working?
Thank You.
HOW IN THE WORLD?
http://firstbornmultimedia.com click portfolio.... how the heck is this done. Can someone please expain? thanks
World Map
started making this for the fx comp but realised it is too processor intensive.
started with a bitmap of the world and then used the commented out code to generate the arrays.
http://www.fmx6.com/teststuff/worldmap.html
How In The World Is This Done?
http://www.asymptote.net/
I'd love to know where to start looking so I can reproduce this menu system? any pointers much appreciated!!
How In The World Do They Do This?
http://www.asymptote.net/
I'd love to know where to start looking so I can reproduce this menu system? any pointers much appreciated!!
How In The World?
Ok, I am getting pretty good at flash (at least I think) however how do you make a flash site like this? Where would one even start? There has to be somekind of reading I could do to accomplish this. Please advise smart flash people. Thank you
http://www.templatehelp.com/preset/p...54x7lHg265esQR
Thanks again
How In The WORLD
How in the world is this done. Someone please give advice. Thank you.
http://www.cpluv.com/www/creativenetwork
World Map
Hi All,
Does anyone know how to create a world map in Flash? I have an example if you go to "montblanc.com" and click on the "Boutique Locator" link on the bottom left corner.
Play around with it because it can get pretty detailed. Anyway, I am creating a "Distribution" page for my website and am looking to create a really cool world map in Flash.
Thanks!
World Map
Hello,
I have drawn out this world map and wanted to show all the places I have visited, and places I will be going to visit. I'm not really sure the best way of doing this though.
so each dot is placed where the city is, as you hover over the dot, the city name appears (it's just a button). is there an efficent way of doing this through script? I can easily place the dots, but the naming of each city im not sure how to do.
cheers
HOW IN THE WORLD?
http://firstbornmultimedia.com click portfolio.... how the heck is this done. Can someone please expain? thanks
World Map
anyone knows how to create a mc like the one in www.nec.com with the world map and when you move your mouse over the map also moves.
thanks
World Map?
anyone know where I can find a good world map that isn't skewed somehow? I've looked on google and such but couldn't find anything to work with. I just need a world map with one color on it and no layer effects or anything like that.
any help would be greatly appreciated.
World Map
I'm being cheeky but does anyone know where there is a free basic world map with xml feed data? I would do it myself but I need it in a rush (as usual!)
Thanks!
World Map
Hi All,
Does anyone know how to create a world map in Flash? I have an example if you go to "montblanc.com" and click on the "Boutique Locator" link on the bottom left corner.
Play around with it because it can get pretty detailed. Anyway, I am creating a "Distribution" page for my website and am looking to create a really cool world map in Flash.
Thanks!
DUMBEST Q IN THE WORLD FROM ME
Alright
the ultimate newbie question
i've made a little digiport type thing
and i've got a few scenes and a button on each all i want the buttons to do is be able to go forward or back on the scenes
i've tried
on (press) {
gotoAndPlay (2);
}
or gotoAndPlay (nextScene);
or whatever
it just ends up running through every scene over and over
HEEEEEEEEEEELP PLEASEEEEEEEEEEEEE
thank you!!!
Is There Anyone In This Small World Who Knows To Do That.
In a single html page there are two separate swf movies, I want to put music in music.swf and on/off button in button.swf and both are places in different tables. Is there any way I can toggle sound on/off this way....?
or
...if both swf movies are placed in different frames?????
Is There Anyone In This Small World Who Knows To Do That.
In a single html page there are two separate swf movies, I want to put music in music.swf and on/off button in button.swf and both are places in different tables. Is there any way I can toggle sound on/off this way....?
or
...if both swf movies are placed in different frames?????
Dynamic World Map - Have You Ever Seen One?
Looking for a world map that breaks out countries into separate symbols .. ideally, I am looking to change the color of the individual countries based on server-fed values. Has anyone come across something that resembles this?
How In The World Do They Do This Guys?
Any help would be good here guys. In the site http://www.pixelbreaker.com, there is a section called "5 months in Hong Kong". If anyone knows how to create this effect please share it with me.
Thanks, SIMIYA
Where In The World Do You Live?
I have a map and want to make it so when people come to my site they can post on the, a lil dot, where they live. I also want them to be able to password protect their dot, so that someone cant delete the dot and in whole screw up the map. i also want to make it so that when u click on someone's dot, you can see the info about them. Does anyone know how i can get started?
Outlined World Map
i need an OUTLINED world map in vector format...can n e one help me with that....??
thnx
What In The World Am I Doing Wrong...Please Help
It's happened to me in the past three websites that I've done, and I don't know what the problem could be
this is a temp address for the site: http://www.nhglink.com/newsite/temp/
the problem is that it's getting stuck on the first scene everytime the page is visited. Yet if the page is refreshed everything works perfect.
you'll see there a gray box with a green corner, that's a swf loaded on level 2 then as soon as it starts a welcome graphic and some text should appear on a level avobe that which is another swf, less than 130Kb. WELL THIS NEVER HAPPENS THE FIRST TIME YOU OPEN THE PAGE. YET IF YOU REFRESH EVERYTHING WORKS PERFECT. Why is this happening please help
I'm using flash 5 here but it happened at home too with flash mx on a different site.
thanks in advance
The Isometric World
I am reading a great Flash MX game design book called Flash MX game design demystified and I am mystified ( no pun intended ) on Chapter 8: The Isometric Worldview.
Now I'm really sorry but I am so stumped it's not funny. This guy talks about rotating the flash coordinate system and I am realy, realy confused. Do any of you have any tips to make me understand this better or can point me to a good website to learn this stuff?
3D World In Flash- How?..
hey
i've seen an example of a pokémon game, where the cursor keys control up,down,left,right.. of a character.
when the character is near an object the user can press another key to make an action (eg. a radio - on or off)
how can i make a character walk?
and how can i make a 3d world ?
any help!? thanks
How In The World Is Motion Like This Done?
I was on www.fordvehicles.com/100 the other day and I noticed the motion of the intro there.
The boxes that well get filled in again and again. The motion begins really slow first and then all of a sudden really fast and then extremely slow again. How is this done?? Its definately not the usual easing. This is different.
Secondly, can someone tell me what exactly is happening there to the boxes? They grow big and then they change colour? What's happening?
Makemedie.
Thanks guys.
I'm NEW To This World Of Flash
Hey, i need help. I'm new to Flash and i just got Flash MX and i've seen people do lots of things with flash. well, theres this site i'm making and evryone keeps telin me in order to put an intro to the site, use flash. but the thing is, i dont know how to use it and i dont know anything bout coding and stuff. i just wanna know if anyone has a certain tutorial or anything that show me how to use Flash MX in Laymen's Terms. Thank You to anyone that helps.
|