• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with understanding script for rotating objects

New Here ,
Aug 13, 2009 Aug 13, 2009

Copy link to clipboard

Copied

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

TOPICS
ActionScript

Views

4.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2009 Aug 17, 2009

Copy link to clipboard

Copied

so that all works perfect, I thank you very much for your help,

the only last thing is the resize of the activeItem menu when you keep rotating around, it stops resizing, not sure what is happening here, its like it does not repeat the same script function?

have you seen this, does it do it on your wheel?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2009 Aug 17, 2009

Copy link to clipboard

Copied

it only happens when you scroll the mouse wheel down through the numbers going from 1 - 25 if you go the other way from 25 - 1 scrolliing the mouse wheel up it resizes ok on ther wheel, mmmhhhh!!!!???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2009 Aug 17, 2009

Copy link to clipboard

Copied

no thats not correct, if you actually click the items, then yes, it does, but if you just use the mouse scroll wheel it does not

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2009 Aug 17, 2009

Copy link to clipboard

Copied

it seems to do it for the first 1 to 25 but then when it loops it seems to not carry the script, is it some kind of repeat script that needs to be added, and if so......where or to what, aaaarrrrrrrrrrrrrrrrggggggggggggghhhhhhhhhhhhhh!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2009 Aug 17, 2009

Copy link to clipboard

Copied

the activeItem scale is set in the circleMenu.as at line 23 here

private var _activeItemScale:                    Number                = 0.8;

and the other size for the item rotating smaller is at line 419

tS = offset == 0 ? activeItemScale : 0.4

is it something to do with the offset???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 17, 2009 Aug 17, 2009

Copy link to clipboard

Copied

The _activeItemScale variable just tells each item what size it should be. You can change the smaller value to make the items appear further apart.

There is a problem with the functions that are called by the scroll wheel. They just keep incrementing or decrimenting the value of currentIndex. This needs to be changed. I won't have time to look at this until much later today, if at all.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2009 Aug 17, 2009

Copy link to clipboard

Copied

Hi rob

thanks for that, I understand you are busy, I am very gratefull for your help on this, if you do get chance I would be very grateful as its a little out of my area, and I am very confused with it all.

many thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

Here's the fix for the scroll wheel functions. There are two functions, next() and prev() at the bottom of CircleMenu.as. Replace those with these:

public function next():void
        {
            currentIndex++;
            if(_currentIndex > _visibleItems) { currentIndex = 0;};

}

       
public function prev():void
        {
            currentIndex--;
            if(_currentIndex < 0) { currentIndex = _visibleItems;};
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

Hi Rob

thanks for that, I seem to get a couple of errors

1.The private attribute can only be used only on a class property

2. the static attribute may be used only on definitions inside a class


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

its ok rob

I sorted it, a little human error

it works great, fantastic, thank you for all your help, you have really help me understand whats going on!

there was one thing I forgot to ask you was reffering to something you said which I didn't quite understand which was;

something about a floating number,  in the case of using 25 items, the value needs to be set to 14.4. So at line 410, change:


where does the number 14.4 come from??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

hi rob

there seems to be a slight difference when you use the mouse scroll wheel and you go from 25 - 1 or 1 -25  it takes an extra click/scroll of the mouse wheel to get to the next item

the actual image does not resize when first scroll to it, you scroll again and then it enlarges???

aaarggggggggggggggghhhhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

Maybe I changed something else in the code. Here's my current copies of CircleMenu.as and Main.as: http://www.ddg-designs.com/downloads/circleCode.zip

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

it seems to do the same thing?

scroll slowly and watch when the item goes from 25 to 1, there is a slight difference or extra scroll you do of the mouse wheel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

at first it resizes correct, but then when you scroll to go to one, number 25 item scrolls smaller, then it takes another scroll of the mouse wheel in order to get to number 1?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

found out what it was chnage the values form 0 to 1

this is what was

public function next():void
        {
            currentIndex++;
            if(_currentIndex > _visibleItems) { currentIndex = 0;};
        }
       
        /**
         * Scrolls the menu to the previous item
         */
       
        public function prev():void
        {
            currentIndex--;
            if(_currentIndex < 0) { currentIndex = _visibleItems;};
        }

this is what I changed it to

public function next():void
        {
            currentIndex++;
            if(_currentIndex > _visibleItems) { currentIndex = 1;};
        }
       
        /**
         * Scrolls the menu to the previous item
         */
       
        public function prev():void
        {
            currentIndex--;
            if(_currentIndex < 1) { currentIndex = _visibleItems;};
        }

seems to work??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2009 Aug 18, 2009

Copy link to clipboard

Copied

LATEST

yep, seems to work great, thank you for all your help, you have been great!!! I really apprecciate your time....many thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines