On Oct 15, 2014 8:34 AM, "Peter Ent" <p...@adobe.com> wrote: > > I just checked in a change to the GraphicShape.js to include setters for x > and y; ActionScript already had them as a result of inheritance. I needed > to have them to change the origin of the <svg> so I could draw chart axes > graphics in the right location. > > I think that change would have been necessary given what's written below.
That's perfect! I went to sleep thinking about this exact thing. And you have it done by the time I am up :-) Thanks, Om > > Peter Ent > Adobe Systems > > On 10/15/14 10:53 AM, "Alex Harui" <aha...@adobe.com> wrote: > > >Did you try it? It should have at least compiled. What error did you > >get? > > > >In FlexJS, MXML is not converted to code, but the net result should be > >equivalent to: > > > >var comp:Object = new Rect(); > >this[³myRect²] = comp; > >comp.width = 300; > >comp.height = 300; > >comp.x = 10; > >comp.y = 10; > >var comp2:Object = new SolidColor(); > >comp2.color = Œ#ff0000¹; > >comp.fill = comp2; > >someParent.addElement(comp); > > > >Note that: > >1) I¹m not sure ³#ff0000² will be converted to 0xFF0000. It might, but if > >not, you can ask the ValuesManager to convert it, which would someday > >allow you to handle ³red², ³green², etc. > >2) The color is applied to SolidColor before it is assigned as the fill. > >3) There is probably no way to get the compiler to generate the call to > >drawRect. Based on what interfaces you implement, you could get notified > >during the addElement call or you could get a setDocument call and draw > >then. You could also require that these elements get wrapped by some > >other class that is a IUIBase and sort of like Canvas, then the Rect and > >other tags become a data structure assigned to a default property in that > >³Canvas². Then when the Canvas is added or resized it would draw based on > >its data. > > > >-Alex > > > >On 10/15/14, 1:05 AM, "OmPrakash Muppirala" <bigosma...@gmail.com> wrote: > > > >>I am quite satisfied with the way the drawing APIs are shaping up. > >>Before > >>I continue adding more APIs, I would like to make them work from MXML so > >>that I can start importing some real graphics (exported from Adobe > >>Illustrator) and see it render in Flash and HTML5. > >> > >>Here is a basic requirement: > >> > >>When I write: > >> > >> <svg:Rect id="myRect" width="300" height="300" x="10" y="10"> > >> <svg:fill> > >> <basic:SolidColor color="#FF0000" /> > >> </svg:fill> > >> </svg:Rect> > >> > >>It must get converted into this code: > >> > >>var myRect:Rect = new Rect(); > >>myRect.fill = new SolidColor(); > >>myRect.fill.color = 0xFF0000; > >>myRect.drawRect(10,10,300,300); > >> > >>How would I go about doing this? > >> > >>I am guessing I need to make changes to my API to make it work from MXML, > >>obviously which I am willing to do. > >> > >>Thanks, > >>Om > > >