Hi there Anupam,

Actually I figured out a way yesterday. The asfunction link calls a 
function in the map which then triggers an event in the AS2 map which is 
passed through a new EIBuffer.addCall which is received by a new event 
handler in MapEventDispatcher.as. The string parameter of the asfunction 
is passed through as a data object and used in Flex and every thing is 
dandy. The only limitation I ran into was the length of text usable with 
asfunction. I believe I saw somewhere that it was 116 characters as a 
limit because of hrefs in general, but it's OK. It works now. :-P

Many thanks!

Michael

anupam_111181 wrote:
>
> Hi All,
> I was just googleing the "asfunction" and found this link
>
> http://livedocs.adobe.com/flex/2/langref/migration.html 
> <http://livedocs.adobe.com/flex/2/langref/migration.html>
>
> See that asfunction is not supported in Action Script 3.0 and the Flex
> 2.0 is using Flash 9 which in turn using AS3 so i think its not that
> straight forward to write asfunction and handling the event..
>
> Although yahoo map component is written in as2 but we are consuming it
> in as3.. My instinct says that there will be some other way that we
> can handle the link click event..
> Working on it..
> Keep u posted
> Cheers!
> Anupam
> --- In [email protected] 
> <mailto:flexcoders%40yahoogroups.com>, Michael Wills <[EMAIL PROTECTED]> 
> wrote:
> >
> > Yeah the POI marker click event is fine and quite useful. I think it
> was
> > after reading your post Anupam. :-) However after that, I can't trigger
> > anything in the Cairngorm app. I even tried to make a function with the
> > original as2map.fla that would simply trigger a new POIMarkerClick
> event
> > with data passed from the asfunction call within the marker. That
> hasn't
> > worked yet either.
> >
> > I also tried to use FlashInterface which, by itself, should work.
> > However it blocks the communication of the YahooMap communication
> kit as is.
> >
> > Basically, similar to Anupam's change to the code, I'd like to add an
> > htmlTextClick function which can be can be called via asfunction.
> > Something like:
> >
> > function onHTMLLinkClick(ev:Object) {
> > var rtnObj:String = new String();
> > EIBuffer.addCall({method:swfDomId + ".onHTMLLinkClick" + id,
> > data:rtnObj});
> > }
> >
> > and where it sets up listeners in the mapClip object
> >
> > myMap.addEventListener('onHTMLLinkClick', onHTMLLinkClick);
> >
> > and then in the description of a POI Marker have
> >
> > description:"<a href=\'asfunction:onHTMLLinkClick,someString\'>Click
> > me...</a>"
> >
> > or would this have to be:
> >
> > description:"<a
> > href=\'asfunction:_parent.onHTMLLinkClick,someString\'>Click me...</a>"
> >
> > and in the Flex project
> >
> > mapEventDispather.addEventListener('onHTMLLinkClick',
> htmlLinkClickHandler);
> >
> > So the link would trigger the new event which would call the
> function in
> > the loaded as2map.swf which would then trigger the new event which
> would
> > be picked up by Flex, etc.
> >
> > So is this possible? Since this function isn't in the original API, is
> > it possible to add it this way? It looks like the .addCall would add it
> > to the methodQueue array in the ExternalInterfaceBuffer.as file. Here's
> > to hoping...
> >
> > And Benoit, thanks for the tip about adding the setMapSize snippet in
> > the MapController.as. It sized fine when first loading but that
> could be
> > VERY useful when dynamically resizing.
> >
> > Thank you to you both. I'll give these a shot and see if there is any
> > progress with it.
> >
> > Michael
> >
> > Benoit Hediard wrote:
> > >
> > > Are you sure you can catch events generated by an href link in the
> > > description htmlText?
> > >
> > >
> > >
> > > I think we've tried to play around with the POIMarkerClick event.
> > >
> > > But it was only dispatched when you first click on the marker to
> open it.
> > >
> > > Further click on a link in the htmlText description was not
> generating
> > > any POIMarkerClick events, so we could not catch anything.
> > >
> > >
> > >
> > > But may be, we did something wrong, we have to check it out again...
> > >
> > >
> > >
> > > Benoit Hediard
> > >
> > > #affinitiz.com
> > >
> > >
> > >
> > > *De :* [email protected] 
> <mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>]
> > > *De la part de* anupam_111181
> > > *Envoyé :* mercredi 25 avril 2007 09:27
> > > *À :* [email protected] <mailto:flexcoders%40yahoogroups.com>
> > > *Objet :* [flexcoders] Re: yahoomaps POI marker click event, htmltext
> > > asfunction
> > >
> > >
> > >
> > > Hi michael,
> > > I have done this and its pretty easy,
> > > You can call any flex event on the click of the marker click
> > > there is one event called onPOIMarkerClick in the Yahoo map component.
> > > You should have the latest code because this event handler was not
> > > there in the previous versions.
> > >
> > > I have written a blog entry on this...
> > > Check it out..
> > >
> http://digitallyinsane.wordpress.com/2007/03/13/yahoo-maps-as3-communication-tool-kit/
>  
> <http://digitallyinsane.wordpress.com/2007/03/13/yahoo-maps-as3-communication-tool-kit/>
>
> > >
> <http://digitallyinsane.wordpress.com/2007/03/13/yahoo-maps-as3-communication-tool-kit/
>  
> <http://digitallyinsane.wordpress.com/2007/03/13/yahoo-maps-as3-communication-tool-kit/>>
> > >
> > > Cheeers!
> > > Anupam
> > > --- In [email protected] 
> <mailto:flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders%40yahoogroups.com>, Michael Wills <michael@> wrote:
> > > >
> > > > For clarification, the idea is simply to allow a marker to be
> > > clicked to
> > > > open it, but then trigger an event/call a function in the
> cairngorm app
> > > > when clicking on a link in the description.
> > > >
> > > > Thanks,
> > > >
> > > > Michael
> > > >
> > > > Michael Wills wrote:
> > > > >
> > > > > Hello all,
> > > > >
> > > > > Just wondering if it's possible to use asfunction to call a
> function
> > > > > in a cairngorm app from the htmltext in the description of a POI
> > > > > marker within a Yahoomap in a Flex 2 app without making
> modification
> > > > > to the as2map.fla file.
> > > > >
> > > > > It's a long shot, but I was just wondering if it's been done, and
> > > > > eagerly anticipating a true AS3 map component.
> > > > >
> > > > > The new AS3 "event:" protocol of course isn't recognized by
> the Flash
> > > > > 8 interpreter and so it's not available.
> > > > >
> > > > > So I was hoping it would be something like:
> > > > >
> > > > > markerDesction = "<a
> asfunction:doNotKnowWhatGoesHere.myFunction/>"
> > > > >
> > > > > Is that a possibility at all?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Michael
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>  

Reply via email to