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

action script objects not displayed

Adobe Employee ,
Mar 29, 2011 Mar 29, 2011

Copy link to clipboard

Copied

Hi,

I am creating an air application using Flex 4.5 compiler. The problem i am facing currently is that i have extended shape class to my custom class movingObject. in this class i have defined a function "drawcircleObj" in this class and calling this class function to display my customized circle on the stage.


But it is not behaving as desired. i.e. no object is being displayed

Views

495

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
Adobe Employee ,
Mar 29, 2011 Mar 29, 2011

Copy link to clipboard

Copied

Adding my code snippets

The as file code

************

package secondPackage
{
    import flash.display.*;
   
    public class movingObject extends Shape
    {
        private var xPos:Number;
        private var yPos:Number;
        private var radius:Number;
        private var color:uint;
       
        public function movingObject()
        {// currently a stub will use it later
                       
        }
       
        public function drawcircleObj(xInput:Number,
                                      yInput:Number,
                                      radInput:Number,
                                      colorInput:uint): void
        {
            xPos = xInput;
            yPos = yInput;
            radius = radInput;
            color = colorInput ;
            this.graphics.beginFill(color);
            this.graphics.drawCircle(xPos,yPos,radius);
        }
}

*************************

The mxml file code

**********************************

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx"
                       creationComplete="initApp()">
 
    <fx:Script>
        <![CDATA[
            import secondPackage.movingObject;
            import flash.display.*;
                       
            private var myMoving:movingObject = new movingObject();
           
            public function initApp():void
            {
                //show the string
               
               
                myMoving.drawcircleObj(500,500,30,0xFF0000);
               
                mainText.text = myMoving.letsStart();
            }
        ]]>
    </fx:Script>
    <s:TextArea id="mainText" x="390" width="50" y="133"/>
   
    <s:Button  id="button1" x="804" y="227" label="Button" width="45"/>
   
   
</s:WindowedApplication>

************

The problem which i suspect is that there should be a stage object holding the same object or circle created and then display it.

A faster reply will be highly appreciated. Thank you.

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
Contributor ,
Mar 29, 2011 Mar 29, 2011

Copy link to clipboard

Copied

LATEST

not exactly AIR but here it is in action:

http://www.trumpboston.com/graphics001/draw_circle.html

ok, so it is not a circle but you get the idea.

poached most of it from o'reilley (sp?)

app:

http://pastie.org/1733797

2ndPackage:

http://pastie.org/1733802

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