trishtren 0 Newbie Poster

Hey, iv been looking around for help with a problem with a program i am working on, but i cant find an appropriate category on any forum really. The program is a flash swf compiler. But at the moment i am having problems understand a certain data structure (the abc block) in particular the int_count.

The adobe documentation says The value of int_count is the number of entries in the integer array
and int_count is a U30, which is an unsigned 30 bit long integer value
The variable-length encoding for u30, u32, and s32 uses one to five bytes, depending on the magnitude of the value encoded. Each byte contributes its low seven bits to the value. If the high (eighth) bit of a byte is set.

The problem i have is that the hex values dont seem to add up to the number of integers i have created in a simple script in actionscript 3. The flex compiler starts counting at 28 in decimal, and i dont know why, making it hard for me to write the abc file structure in java.

The problem i have is that the hex values dont seem to add up to the number of integers i have


    import flash.display.Sprite; 

    public class Main extends Sprite 

        public function Main():void 
            if (stage) init(); 
            else addEventListener(Event.ADDED_TO_STAGE, init); 

            var integervalue1:int = 5; 


        private function init(e:Event = null):void 
            removeEventListener(Event.ADDED_TO_STAGE, init); 



This should give a u30 hex value of 1, but i instead end up with :

1D 04 4D 61

Similarly the more new integers i declare only the first value of the hex increases :

1E 04 4D 61

So my question is this, why does the hex value only use 8 bits when its mean to use 30, and why doesent it start at 0, or 1 instead of starting at the decimal value of 28?

Incase it is reqired here is the tags first few lines of hex :

bf 14 96 02 00 00 01 00 00 00 4d 61 69 6e 00 10    |**********Main** |    
00 2e 00 00 00 00 **1d 04 4d 61 69** 6e 00 31 43 3a | *.******Main*1C: |

Any help to decipher why it uses 28 values to begin with would be incredibly helpful to me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.