Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Actionscript 3 sprite.graphics.drawPath function not working

Posted on 2011-03-24
3
Medium Priority
?
885 Views
Last Modified: 2012-08-13
Here's my code and some of the errors i get - the omitted errors are the same as those listed.

protected function DrawArrow(oSprite:Sprite, nColorIndex:Number, nStyle:Number)
{
            var star_commands:Vector.<int> = new Vector.<int>();
            star_commands.push(1, 2, 2, 2, 2);
            
            var star_coord:Vector.<Number> = new Vector.<Number>();
            star_coord.push(66,10, 23,127, 122,50, 10,49, 109,127);
            
            oSprite.graphics.beginFill( m_aScrollerColors[nColorIndex] );
            oSprite.graphics.drawPath( star_commands, star_coord );
            ...

CMenuScroller.as, Line 114      1120: Access of undefined property int.
CMenuScroller.as, Line 114      1120: Access of undefined property Number.
CMenuScroller.as, Line 114      1061: Call to a possibly undefined method drawPath through a reference with static type flash.display:Graphics.

Any ideas why this won't work?
With Thanks
0
Comment
Question by:jasonb2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35220390
I guess you are wrong here:
 var star_commands:Vector.<int> = new Vector.<int>();
star_commands.push(1, 2, 2, 2, 2);
           
var star_coord:Vector.<Number> = new Vector.<Number>();
star_coord.push(66,10, 23,127, 122,50, 10,49, 109,127);

You will have to push the values individually.
 
var star_commands:Vector.<int> = new Vector.<int>();
star_commands.push(1);
star_commands.push(2);
star_commands.push(2);
star_commands.push(2);
star_commands.push(2);
            
var star_coord:Vector.<Number> = new Vector.<Number>();
star_coord.push(66);
star_coord.push(10);
star_coord.push(23);
star_coord.push(127);
star_coord.push(122);
star_coord.push(50);
star_coord.push(10);
star_coord.push(49);
star_coord.push(109);
star_coord.push(127);

Open in new window


Warm Regards
Deepanjan Das
0
 
LVL 4

Accepted Solution

by:
ute_arbeit earned 500 total points
ID: 35224653
The code creating and filing the vectors seems ok. You don't have to push the values one by one, Vector.push takes multiple arguments.
Also the rest of your code with the call to drawPath seems ok to me.

The only thing I can imagine is that you did not set ActionScript 3.0 as the scripting language for your file. If it is set to ActionScript 2.0 all the Vector stuff is not supported and you get compiler errors.
Please make sure you have ActionScript 3.0 set in your settings for publishing.
0
 

Author Comment

by:jasonb2
ID: 35228221
thanks guys.
I got it to work.
I changed the 'player' setting in 'publish settings' from 'player 9' to 'player 10".
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question