| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Feb 2006
Posts: 22
|
Here the code, it cause error because it try to convert graphics to UI Component
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()" backgroundAlpha="0">
<mx:Script>
import flash.display.*;
import mx.controls.listClasses.*;
import mx.collections.*;
import mx.controls.*;
import com.graphics.*;
private function initApp():void
{
var circle:Shape = new Shape()
var xPos:Number = 100;
var yPos:Number = 100;
var radius:Number = 50;
circle.graphics.beginFill(0xFF8800);
circle.graphics.drawCircle(xPos, yPos, radius);
this.addChild(circle);
}
</mx:Script>
<mx:Canvas id="cvs" width="200" height="200">
</mx:Canvas>
</mx:Application>
|
|
|
|
|
|
#2 |
|
lala
Join Date: Feb 2002
Location: on the road
Posts: 2,859
|
there are two sollutions to this problem, and it depends on what you want which one will work for you.
ActionScript Code:
or ActionScript Code:
so the difference between the two is that in the first case flex will manage all the resizing and the rest of your item for you in the application, in the second case you are bypassing flex and just adding it to the display list directly |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Feb 2006
Posts: 22
|
Thanks it work.
There is a slightly change. Instead of UIObject. Need to use UIComponent var circle:UIComponent = new UIComponent(); Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()" backgroundAlpha="0">
<mx:Script>
import flash.display.*;
import mx.controls.listClasses.*;
import mx.collections.*;
import mx.controls.*;
import com.graphics.*;
private function initApp():void
{
var circle:UIComponent = new UIComponent();
var xPos:Number = 100;
var yPos:Number = 100;
var radius:Number = 50;
circle.graphics.beginFill(0xFF8800);
circle.graphics.drawCircle(xPos, yPos, radius);
this.addChild(circle)
}
</mx:Script>
<mx:Canvas id="cvs" width="200" height="200">
</mx:Canvas>
</mx:Application>
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting Actionscript 1.0 to Actionscript 2.0 | DNG | ActionScript 2.0 | 5 | 11-30-2005 07:57 PM |
| drawing using actionscript | Animus | ActionScript 1.0 (and below) | 3 | 07-12-2005 07:16 PM |
| all actionscript site...how in the world? | dpaslay (work) | ActionScript 2.0 | 1 | 07-22-2004 03:31 AM |
| Actionscript shape drawing... | johnglynn | ActionScript 1.0 (and below) | 4 | 05-17-2004 04:55 PM |
| Drawing a line with ActionScript?? | BeWare | ActionScript 1.0 (and below) | 5 | 02-01-2001 10:43 AM |