Dude, that is so easy. You just:
- import each graphic into Flash
- give it an instance name
- modify the code I posted to do:
var c:Color = new Color(targetState);
c.setRGB(0xFF0000);
That'll set it red, and ONLY it. If you have
the graphic as a PNG or GIF (transparency intact), it'll color just the shape
with nice edges.
You could do the same in Flex as well, just embed
the images:
[Embed(source="maine.png")]
var main_png:String;
<mx:Image id="main_png_img" source="{main_png}"
/>
And set the color the same way:
var c:Color = new Color(main_png_img);
c.setRGB(0xFF0000);
Flash, Flex... either one. Additionally,
Bline Express created a pretty phat USA Map component with all 50 states.
Methods already exist in it to set colors, know which state you clicked on,
etc. It's written for Flash 6, but you could easily load that into a Flex
Loader, and use proxy functions to call the Flash 6 methods in the externally
loaded SWF.
Bring it.
----- Original Message -----
Sent: Wednesday, December 28, 2005 12:13 AM
Subject: Re: [flexcoders] Having hard time understanding what
features are available to whom when and how
Thanks for the prompt reply.
I can see how your suggestion
would work, but in my case I don't think I can use the background color.
Imagine if the shapes were the six states of New England on a map. I want
to be able to control the color of each state to be one of eight colors.
I can see a few approaches. One would be to treat the whole map of
New England as a graphic and then somehow repaint the individual state, perhaps
on a pixel by pixel basis. I suppose that could work, but it would be
tedious.
Another way would be to have a graphic object of each state
with a transparent background and then overlay them appropriately in their
appropriate positions. However, the color I would have to then change
would be the foreground object color and I don't know that there is a simple way
to do that. I could, perhaps, supply eight graphics for each state and
then switch between them using _javascript_ to alter the DHTML. That might
be feasible for six states, but if the map included all fifty states, I would
need at least 50 * 8 graphic objects to use that approach.
A third way
might be to somehow use areamaps and regions, but I don't know if that would
result in DHTML where I could easily recolor a region.
What do you think
would work?
Bruce
On 12/28/05, JesterXL
<[EMAIL PROTECTED]>
wrote:
Can help with #3.
Here's a sample:
<?xml version="1.0"
encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml
" initialize="initApp()"> <mx:Script> <![CDATA[ import
mx.controls.ComboBox; private function
initApp():Void { var color_str:String =
color_cb.selectedItem.toString(); colorMe_box.setStyle("backgroundColor",
color_str); } private function
setColor(event:Object):Void { var cb:ComboBox =
ComboBox(event.target); var color_str:String =
cb.selectedItem.toString(); colorMe_box.setStyle("backgroundColor",
color_str);
} ]]> </mx:Script> <mx:FormItem
label="Colors:"> <mx:ComboBox id="color_cb" change="setColor(event)"> <mx:dataProvider> <mx:Array> <mx:String>0x000000</mx:String>
<mx:String>0x660000</mx:String> <mx:String>0x000066</mx:String> </mx:Array> </mx:dataProvider> </mx:ComboBox> </mx:FormItem> <mx:Box
id="colorMe_box" borderStyle="solid" width="100"
height="100"/>
</mx:Application>
----- Original Message -----
Sent: Tuesday, December 27, 2005 8:01 PM
Subject: Re: [flexcoders] Having hard time understanding what
features are available to whom when and how
I've used Axis on other projects, but I'm not sure how this
interaction as a RemoteObject would look in the context of Flex 2.0 . Do
you know of a working example of this somewhere? I'm not sure what I
would code on the Flex side and I'm not sure what I'd need to do on the server
side to make it compatible and synchronize.
I'm also wondering whether
everything is available to support developing this demo for as long as it
takes or if I will at some point have to buy a license for one thing or
another to continue development. I also need to know how to explain the
production operational costs to a potential investor. Potentially this
is an application run by large companies on their own servers for many
subscribers.
And from a technical viewpoint, I'm still wondering how
to implement these arbitrary small shapes (such as states on a map) that need
to change to one of a number of colors. I'd probably be able to answer
that by myself if I were a Flash developer, but my Flash experience is limited
to having run through the examples of a much earlier version of Flash.
I know that's a lot of questions.
Thanks, Bruce
On 12/27/05, Matt
Chotin <[EMAIL PROTECTED] >
wrote:
I
think you'll find 1.5 a more stable development experience in the
next month though of course 2.0 offers a lot of stuff. For
RemoteObject in 2.0 for now you do need the 2.0 CF adapter, but as many
folks will be happy to point out you could also just expose your Java
objects via a WebService using Apache Axis instead (this should be done
in the 2.0 samples maybe but is definitely in 1.5 for reference).
The Flex 2 alpha will hint at functionality (like RemoteObject) that may
not actually be functional in your
configuration.
Matt
-----Original Message----- From: flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of JesterXL Sent: Tuesday,
December 27, 2005 4:39 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders]
Having hard time understanding what features are available to whom when
and how
I cannot answer all of your questions, but here are my
suggestions. - assuming on Windows, download Apache Tomcat - download
Flex 1.5 demo - install Flex 1.5 demo with just FlexBuilder 1.5 - copy
and paste the flex.war & samples.war files into Tomcat's webapps
directory
Hit the samples page to ensure all is well. On
mine, it's:
http://localhost:8080/samples/
I've yet to get Flex
2 to work with Remoting + AMFPHP. Considering AMF (the binary
format used to send serialized class bits across the wire) is undergoing
big changes, OpenAMF (Java) and AMFPHP (PHP) don't really work
yet.
I've heard of some people getting Remoting to work with the
CFAdapter, but I don't use CF ( I do at work, but I don't code
it). Some have reported success with the
WebService/HTTPService.
Me? I use Flex 1.5 every day and it
works great. At night, I moonlight in Flex 2, but she's still
alpha, so we have a ways to go.
The bad news is, for those client
developers (like me) who only care about the client, Flex 1.5 has the
server requirement. However, you can still
snag SWF's off of
the server once compiled as well as to show clients of
what's
possible. Good news, she works great, HTTPService (GET/POST) works,
WebService works, and RemoteObject works with AMFPHP, OpenAMF, and
ColdFusion.
Hope that helps some. Feel free to post more
questions.
----- Original Message ----- From: "BCichowlas" <[EMAIL PROTECTED]> To: <
flexcoders@yahoogroups.com> Sent: Tuesday, December 27, 2005 4:22
PM Subject: [flexcoders] Having hard time understanding what features are
available to whom when and how
Hi!
I'm an independent
developer trying to put together an RIA demo for potential investors in a
proposed enterprise. This proposed enterprise is not a software
company but would make heavy use of an RIA application.
My most
reasonable choices seem to be Flex, Laszlo or Ajax (in its many
variations). I spent the last week with the Iteration Two
Flex book, downloading what is available freely to developers from
the Macromedia/Adobe site.
As part of my demo, I need to be able
to change the color of irregular small shapes. The shapes
themselves are known in advance and don't change. For the sake of
discussion, it is as if I had an outline of New England, divided into the
six New England states and I wanted to be able to choose one of eight
colors for each of the states based on user interaction.
After
looking at the complexities of Ajax, Flex seemed like an
ideal choice. Since I develop under Eclipse and since the 2.0 alpha
seemed like a generally usable version, it was my first choice.
However, the examples in the Iteration Two book seem to be written for
1.0 or 1.5, and I spent quite a while trying to run them under 2.0 with
varying degrees of success.
My database needs for this demo
application are modest, but I did want to be able to use
RemoteObject. I was never able to get anything using RemoteObject
to operate successfully. I was developing under Eclipse and using
the "Run Flex application" to try to run my application. I'm not
sure exactly what runtime environment this results in, but I had been
successful at getting some small forms running successfully and trading
string messages with the server.
Is RemoteObject supposed to be
possible using only the 2.0 alpha materials? If not, what do I
need? The Cold Fusion server extensions? The Enterprise
version? Is what I need available now? Does it cost money just to
use for a demo? Are there some examples of using a RemoteObject
under 2.0 that I could try under Eclipse? Should I be using 1.5
instead?
I am wondering if my expectations of the 2.0 alpha are
inappropriate for programming a demo now and in January 2006. I'm
not a Cold Fusion user and have only a rudimentary understanding of its
operation. I'm now thinking that I should use Ajax or possibly
Laszlo, but would listen carefully to any argument that Flex is the right
choice.
Thanks, Bruce
-- 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
-- Bruce
Cichowlas Affirm Tech Software Development and Consulting http://www.affirmtech.com [EMAIL PROTECTED] (508)-904-6122
-- 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
-- Bruce
Cichowlas Affirm Tech Software Development and Consulting http://www.affirmtech.com [EMAIL PROTECTED] (508)-904-6122
--
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
|