Skip to main content
Known Participant
August 13, 2009
Question

Help with understanding script for rotating objects

  • August 13, 2009
  • 2 replies
  • 5029 views

Hi all

would some help me with this, I am trying to understand what part of AS3 script says loop through(create a continues 360 loop of objects) the images from an XML file, does this make any sense.

in my script I have this

for(var i:int = 0; i < images.length(); i++)

is this the part that says loop the images/objects

this is a little more to the script including the above to maybe understand better?

private function onXMLComplete(event:Event):void
{
// Create an XML Object from loaded data
var data:XML = new XML(xmlLoader.data);
           
// Now we can parse it
var images:XMLList = data.image;
                       
for(var i:int = 0; i < images.length(); i++)  <<<<<<<<FROM ABOVE ///        {

// Get info from XML node
var imageName:String = images.@name;
var imagePath:String = images.@path;
var titles:String = images.@title;
var texts:String = images.@text;

any help would be great

This topic has been closed for replies.

2 replies

robdillon
Participating Frequently
August 14, 2009

Try this, change line 425 of CircleMenu.as from:

TweenLite.to( item, 0.5, { x:tX, y:tY, rotation:tR, scaleX:tS, scaleY:tS, alpha:tA, ease:Expo.easeOut } );

to these two lines:

TweenLite.to( item, 0.5, { x:tX, y:tY,  scaleX:tS, scaleY:tS, alpha:tA, ease:Expo.easeOut } );
item.rotation = tR;

Its the tween that is causing the odd twirl.

Known Participant
August 17, 2009

Hi Rob

many thanks for that, thats great, it works, stops the spin/twirl effect.

two things I have come across are;

1.)when you continue to rotate around the 'ActiveItem' after the first rotation, stops enlarging,

2.)spreading the space between Items

before you could change the values within the main.as at line 31 here

circleMenu = new CircleMenu(340, 88, 25);

but they don't seem to space out the items any more, I remember you saying something about the values being redundant after a few changes,

How can I space out the item within the wheel now??

Known Participant
August 17, 2009

ok

I have been playing around with the values at line 31 Main.as

this is what I have got so far chnaged from;]

circleMenu = new CircleMenu( 340, 88, 12);
circleMenu.x = 200;
circleMenu.y = 300;

addChildAt( circleMenu, 0 );

to

circleMenu = new CircleMenu(620, 18, 25);
circleMenu.x = 30;
circleMenu.y = 300;
addChildAt( circleMenu, 0 );

I just can't seem to 'Bend' /radius the curve of the wheel to that little more, any thoughts???

robdillon
Participating Frequently
August 13, 2009

The code that you quote here just assigns values to variables from the data in the xml file. There must be more to this code, can you share that?

Known Participant
August 13, 2009

hi there

many thanks for your reply, yes there is, and yes I would love to share it, but I didn't want to scare people off as the code includes two files  main.as and circlemenu.as

would you rather I paste the code here or send you to a link where you can download my rotating menu?

many thanks for your input

Known Participant
August 13, 2009

Use a link.


hi there

ok here is the link, it contains all files, you will see when you run it how that the images stop at image 1 and at image 25 all I want to do is just create a loop so it keeps going round.

I have been playing around with this values within the CircleMenu.as, it enables you to control what image the menu stops at...line 93 of circlemenu.as

if ( value < 4 ) value = 4;
if ( value > 22) value = 22;

this is what it originally is

if ( value < 1 ) value = 1;
if ( value > numChildren ) value = numChildren;


again I don't think though that this is part of the loop effect???

heres the link to files

http://art.clubworldgroup.com/menu/example_01.zip

I would have thought it was something to do with this from main.as line 67 but I can't get the correct script???

for(var i:int = 0; i < images.length(); i++)

many thanks for your help, I hope I am making sense???