Professional Web Applications Themes

paint object - Macromedia Flex General Discussion

Hello! I need little problem. I have application with following code <mx:Script> <![CDATA[ import source.PositionObjectMap; import mx.collections.ArrayCollection; function init(par:int) { var g:PositionObjectMap = new PositionObjectMap(); if (ui.numChildren > 0) ui.removeChildAt(0); g.mashX = g.mashX + par * 2; g.mashY = g.mashY + par * 2; g.init(); ui.addChild(g); } ]]> <mx:Canvas id="er" x="5" y="69" width="800" height="500"> <mx:UIComponent id="ui" height=" 500" width="800" creationComplete="init(0)" x="0" y="0" /> </mx:Canvas> and I have code class where art object in this place (UIComponent). Code class PositionObjectMap is following: /* * Scale count in 100 pixel. */ package source { import flash.display.CapsStyle; import flash.display.JointStyle; import flash.display.LineScaleMode; import flash.display.Sprite; ...

  1. #1

    Default paint object

    Hello!
    I need little problem.
    I have application with following code
    <mx:Script>
    <![CDATA[
    import source.PositionObjectMap;
    import mx.collections.ArrayCollection;
    function init(par:int)
    {
    var g:PositionObjectMap = new PositionObjectMap();
    if (ui.numChildren > 0) ui.removeChildAt(0);
    g.mashX = g.mashX + par * 2;
    g.mashY = g.mashY + par * 2;
    g.init();
    ui.addChild(g);
    }
    ]]>
    <mx:Canvas id="er" x="5" y="69" width="800" height="500">
    <mx:UIComponent id="ui" height=" 500" width="800" creationComplete="init(0)"
    x="0" y="0" />
    </mx:Canvas>
    and I have code class where art object in this place (UIComponent).
    Code class PositionObjectMap is following:
    /*
    * Scale count in 100 pixel.
    */
    package source
    {
    import flash.display.CapsStyle;
    import flash.display.JointStyle;
    import flash.display.LineScaleMode;
    import flash.display.Sprite;
    import mx.collections.ArrayCollection;
    public class PositionObjectMap extends Sprite
    {
    var color:uint = 0x00003F;
    var RES_POINT:int = 0;
    var RES_CIRCLE:int = 1;
    var RES_SV = 2;
    var RES_SECTOR = 3;
    var x1:Number = 2000;
    var y1:Number = 1000;
    public var mashX:Number = 300;
    public var mashY:Number = 300;
    var x2:Number;
    var y2:Number;
    var xLenght:Number = 685;
    var yLenght:Number = 480;
    var moX:int;
    var moY:int;
    public var dataMap:ArrayCollection = new ArrayCollection([

    {type:RES_POINT,latitude:"2500",longitude:"1800",r adius:"4",corner:"1",widthCo
    rner:"0"},

    {type:RES_CIRCLE,latitude:"3100",longitude:"1200", radius:"180",corner:"2",widt
    hCorner:"0"},

    {type:RES_SECTOR,latitude:"2200",longitude:"2200", radius:"30",corner:"0.2",wid
    thCorner:"2"},

    {type:RES_CIRCLE,latitude:"4000",longitude:"2350", radius:"250",corner:"2",widt
    hCorner:"0"},
    ]);
    public function ObjectMap(data:ArrayCollection = null)
    {
    super;
    // dataMap = data;
    }
    public function init()
    {
    x2 = x1 + (mashX * xLenght / 100);
    y2 = y1 + (mashY * yLenght / 100);
    var cX:Number;
    var cY:Number;
    for (var i:int = 0; i < dataMap.length;i++)
    {
    cX = Math.round((dataMap[i].latitude - x1) / mashX * 100);
    cY = Math.round((dataMap[i].longitude - y1) / mashY * 100);
    imgObject(dataMap[i].type , cX, cY,
    Number(dataMap[i].radius),Number(dataMap[i].corner),Number(dataMap[i].widthCorne
    r));
    }
    }
    function
    imgObject(type:int,Cx:int,Cy:int,r:int,corner:Numb er,widthCorner:Number)
    {

    this.graphics.lineStyle(1, color, 1, false, LineScaleMode.VERTICAL,
    CapsStyle.NONE, JointStyle.MITER, 10);
    this.graphics.beginFill(color);
    if (type == RES_POINT) { //paint point
    this.graphics.drawCircle(Cx,Cy,r);
    this.graphics.moveTo(Cx,Cy);
    this.graphics.lineTo(Cx + r * 3 * Math.cos(corner) , Cy - r * 3 *
    Math.sin(corner));
    this.graphics.beginFill(0xe1e1e1);
    this.graphics.drawCircle(Cx,Cy,r-1);
    }

    if (type == RES_CIRCLE) {//paint circle area
    this.graphics.drawCircle(Cx,Cy,2);
    moX = Cx + r;
    moY = Cy;
    this.graphics.moveTo(moX ,moY);
    for (var i:Number = 0; i <= 6.3 ; i=i+ 0.05)
    {
    var cx1:Number = Cx + r * Math.cos(i);
    var cy1:Number = Cy - r * Math.sin(i);
    this.graphics.lineTo(cx1, cy1);
    this.graphics.moveTo(cx1, cy1);

    }
    }

    if (type == RES_SECTOR) { //paint sector
    this.graphics.drawCircle(Cx,Cy,2);
    this.graphics.moveTo(Cx,Cy);
    for (var i:Number = corner - widthCorner/2; i <= corner + widthCorner/2 ;
    i=i+ 0.1)
    {
    var cx1:Number = Cx + r * Math.cos(i);
    var cy1:Number = Cy - r * Math.sin(i);
    this.graphics.lineTo(cx1, cy1);
    this.graphics.moveTo(cx1, cy1);
    }
    this.graphics.lineTo(Cx, Cy);
    }
    this.graphics.endFill();
    }
    }
    }

    This object paint with place boundary, i.e. where position data point not in
    place from 0 to 685 on Xaxis and and not in place Yaxis, this object painted
    to, but it is unnecessary. How does it avoid?

    Dema_In_Russia Guest

  2. #2

    Default Re: paint object

    are you sure you class compiles? because the line:

    mgObject(dataMap.type , cX, cY,
    Number(dataMap.radius),Number(dataMap.corner),Numb er(dataMap.widthCorner));

    I don't see how dataMap.corner could work? Did you mean to write
    dataMap[i].corner?

    atta707 Guest

  3. #3

    Default Re: paint object

    Yes. I'm sure. It class is works and compiles.
    It paint normal Object.
    DataMap.corner have used where paint sector, else it not need.

    Dema_In_Russia Guest

Similar Threads

  1. paint at 3d window
    By roni_shukha in forum Macromedia Director 3D
    Replies: 0
    Last Post: January 11th, 10:47 AM
  2. paint bucket
    By Leen Koper in forum Adobe Photoshop Elements
    Replies: 11
    Last Post: September 3rd, 12:32 AM
  3. Where is the paint bucket in 7.0?
    By Milo Shapiro in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 2
    Last Post: July 20th, 05:19 PM
  4. Paint Program
    By Ken Hammond in forum Windows XP/2000/ME
    Replies: 1
    Last Post: July 17th, 03:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139