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

Help with understanding script for rotating objects

New Here ,
Aug 13, 2009 Aug 13, 2009

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
5.2K
Translate
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

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?

Translate
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

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!!!!???

Translate
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

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

Translate
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

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!!!

Translate
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

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???

Translate
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

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.

Translate
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

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

Translate
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

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;};
}

Translate
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

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


Translate
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

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??

Translate
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

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!!!!!!!!!!!!!!!!!

Translate
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

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

Translate
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

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

Translate
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

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?

Translate
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

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??

Translate
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
LATEST

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

Translate
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