Last night, I was able to find a demo called SpriteArranger that showed addng different types of objects as children to a DisplayCanvas . This really helped in understanding the AddChild. I think I'll go with the displayobjects initially since we have a PC version written that uses the same approach. I still am having issues with panning an image left, right... Then the next things I need to figure out are:
1. Making an internal searchable list of children. I saw the AddChild function, but the displayobject does not have a Children Property. I need to research the different types of arrays and find one that I can have a key associated with the object so as data comes in, I can update sprite 47. Is there a HashArray or something similar. These maybe simple questions but I am brand new to this stuff. There seems to be tons of docs but few examples. 2. On the panning issue, lets say I have a map background that is 1000x1000. My viewport is 200X400, I need to understand how to control the viewport and panning. 3. Memory Management. As you mentioned, tons of objects will have issues, I need to get a feel for how many is too many, if the user switches maps, how to delete the children... Thanks for your help, Rich --- In flexcoders@yahoogroups.com, "JesterXL" <[EMAIL PROTECTED]> wrote: > > Base class is like DisplayObjectContainer, but that's an abstract class; > both Sprite and MovieClip extend that. However, if you are using Flex, > there is no point to utilize MovieClip since you don't have frames; Sprite's > good. Also, the last line should be addChild(container), at least in an AS3 > project. > > ...however, you have 2 choices here. > > DisplayObjects are nice because you can put all of your map data in one > DisplayObject, and then move just that 1 Sprite, scale that 1 sprite, ect. > It makes your code really concise, and flexible because you can put anything > you want in it. Think how Yahoo Maps and Google Maps have like textures, > directions, lines, markers, etc. all in theirs. > > ...but tons of obects, while better in Flash Player 9, are still slower than > 1 bitmap. If you aren't planning of going all charting-style, you outta > give thought to a blitting solution if you want her to scale hardcore. You > basically draw everything to an offscreen bitmap, and then use a Rect to > copyPixels into an on-screen bitmap. That way, you could add thousands of > objects, and you're map would run really well. Harder to code and less > flexible, though. Sprites and the DisplayObject really nice, so..... > > ----- Original Message ----- > From: "richmcgillicuddy" <[EMAIL PROTECTED]> > To: <flexcoders@yahoogroups.com> > Sent: Tuesday, July 25, 2006 8:29 PM > Subject: [flexcoders] Re: Image Pan - Step 1 > > > OK, just needed the right terms to search on. Found this in the help: > > > import flash.display.Sprite; > import flash.events.MouseEvent; > > var container:Sprite = new Sprite(); > container.name = "container"; > > var circle:Sprite = new Sprite(); > circle.name = "circle"; > circle.graphics.beginFill(0xFFCC00); > circle.graphics.drawCircle(40, 40, 40); > > container.addChild(circle); > > container.mouseChildren = false; > > container.addEventListener(MouseEvent.CLICK, clicked); > > function clicked(event:MouseEvent):void { > trace(event.target.name); // container > } > > > Then, it states to add the container to the DisplayObject. This is > where I get confused. What is the base container class for the > DisplayList and how do I attach it? I don't think I need a movie clip > becuase it says it basically is a sprite with a timeline. > > > Rich > > > --- In flexcoders@yahoogroups.com, "JesterXL" <jesterxl@> wrote: > > > > 2. If they are children, they too will scale. Add them to the Sprite's > > displaylist. > > > > 3. We've done this successfully in Flex 1.5. In Flex 2, you can set > the > > toolTipClass on the ToolTipManager class to utilize your own class. > > > > 4. To combine multiple effects at the same time, utilize the > <mx:Parrellel> > > tag; it'll make all effects inside it happen at the same time (exluding > > their own startDelay attributes). > > > > Have you tried replacing x & y with scrollRect? > > > > ----- Original Message ----- > > From: "richmcgillicuddy" <rich@> > > To: <flexcoders@yahoogroups.com> > > Sent: Tuesday, July 25, 2006 3:02 PM > > Subject: [flexcoders] Image Pan - Step 1 > > > > > > Hello, > > > > > > I am new to the group and to Flex/Flash. We have a mapping tool that > > we had created about a year back that uses flash 8. We want to move up > > to Flex 2 for a number of reasons. I am trying to create the mapping > > hello world application. We use a standard png image as the background > > for the map. I am trying to create a simple image in a panel that has > > a series of buttons to the left where I can zoom in/out and pan in all > > directions. The zoom in/out is working fine (although I have questions > > regarding that) but the pan is not working. My code is attached to the > > bottom of this email message. Logically the steps I need to go through > > to get this to work are: > > > > 1. Simple map - Image management Pan Zoom.... Possibly overview window > > similar to Google or Yahoo. > > 2. Create an object that is a member of that map. This object needs to > > be able to display itself as a number of different types (Images, > > dots, characters). After reading through tutorials, I can create my > > own object that descends from a sprite. My questions here are will the > > dot zoom and coordinate based on the zoom, pan of the background map? > > How can I make that happen? > > 3. More complex tooltips than the standard tooltips. I want a tooltip > > that displays about 5-10 lines of information and possibly links to > > other areas of the web site. Would you just create a separate window > > to act as a tooltip window and place whatever information in the > > window you need? > > 4. Incorporating effects to the movements of these objects. I've seen > > the component explorer, I want the movement of these items on the map > > to slide from one spot to the other. The demo app in the explorer > > works well. How would you combine multiple effects to happen at the > > same time? > > > > Any help would be greatly appreciated. > > > > > > Step 1 Source Code > > > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="horizontal"> > > <mx:Script> > > <![CDATA[ > > > > private function panUp():void { > > myMap.scrollRect.top -= 10; > > trace(myMap.scrollRect); > > if (myMap.scrollRect.top < 0) { > > myMap.scrollRect.top = 0; > > } > > } > > > > private function panDown():void { > > myMap.scrollRect.top += 10; > > trace(myMap.scrollRect); > > if (myMap.scrollRect.top < 0) { > > myMap.scrollRect.top = 0; > > } > > } > > > > private function panRight():void { > > myMap.scrollRect.left += 10; > > trace(myMap.scrollRect); > > if (myMap.scrollRect.left < 0) { > > myMap.scrollRect.left = 0; > > } > > } > > > > private function panLeft():void { > > myMap.scrollRect.left -= 10; > > trace(myMap.scrollRect); > > if (myMap.scrollRect.left < 0) { > > myMap.scrollRect.left = 0; > > } > > } > > > > private function zoomIn():void { > > myMap.scaleX += 0.1; > > myMap.scaleY += 0.1; > > } > > > > private function zoomOut():void { > > myMap.scaleX -= 0.1; > > myMap.scaleY -= 0.1; > > } > > ]]> > > </mx:Script> > > <mx:VBox height="100%"> > > <mx:Button label="Left" id="btnLeft" click="panLeft()"/> > > <mx:Button label="Right" id="btnRight" click="panRight()"/> > > <mx:Button label="Up" id="btnUp" click="panUp()"/> > > <mx:Button label="Down" id="btnDown" click="panDown()"/> > > <mx:Spacer/> > > <mx:Button label="Zoom In" id="btnZoomIn" click="zoomIn()"/> > > <mx:Button label="Zoom Out" id="btnZoomOut" click="zoomOut()"/> > > </mx:VBox> > > <mx:Panel width="100%" height="100%" layout="absolute" > > cornerRadius="33" backgroundColor="#c0c0c0" id="myPanel" title="Map > > Basics 101" fontFamily="Georgia" fontSize="16"> > > <mx:Image horizontalCenter="20" verticalCenter="20" width="504" > > height="601" source="SB memorial map.png" scaleContent="false" > > id="myMap"/> > > </mx:Panel> > > > > </mx:Application> > > > > > > > > > > > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > Yahoo! Groups Links > > > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > ------------------------ Yahoo! Groups Sponsor --------------------~--> See what's inside the new Yahoo! Groups email. http://us.click.yahoo.com/3EuRwD/bOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/