Advanced Flash Components
Search!
Search!
Home >  Forum
  SearchSearch   
How to run UMap AS3 in Flex Builder 2
Goto page Previous  1, 2, 3  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> UMap ActionScript 3.0
View previous topic :: View next topic  
Author Message
mkroll
AFC Member


Joined: 16 Jan 2008
Posts: 6

PostPosted: Thu Jan 24, 2008 11:07 am    Post subject: Reply with quote

Well I not meant the Gmap.mxp version of the GMap, but I'm looking for a precomplied AS2/Flash8 version in *.swf format.
Is such a file available? I don't have Adobe tools on hand, but want to interate the swf file directly using it as library.

Regards,
Michael.
Back to top
View user's profile Send private message
shrisangeeta
AFC Member


Joined: 28 Jan 2008
Posts: 3

PostPosted: Tue Jan 29, 2008 5:59 am    Post subject: Working example of UMap component in Adobe flex 3 beta Reply with quote

hi, i am using adobe flex 3 beta, and checked this component y should not work in flex??? so here i am with a solution,

plese download the latest Umap flex *.swc and add it to u r project path as "add swc". copy and paste below code to u r MXML;

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
   creationComplete="onCreationComplete(event)" width="100%">
   <mx:Script>
      <![CDATA[
      import mx.core.UIComponent;
      import mx.controls.Alert;
      import com.afcomponents.umap.core.UMap;
       import com.afcomponents.umap.types.*;
      
    public function onCreationComplete(event:Event) : void
         {
            var ref : UIComponent = new UIComponent();
            mapCanvas.addChild(ref);
            var gmap:UMap = new UMap();
           gmap.setSize(300, 300);
           gmap.setCenter(new LatLng(23.402765, 77.871094),4); 
         ref.addChild(gmap);

         }

      ]]>
   </mx:Script>
   <mx:Canvas id="mapCanvas" width="690" height="506" backgroundColor="#352D69" x="6" y="10"/>

</mx:Application>
Back to top
View user's profile Send private message
a903888
AFC Member


Joined: 07 Feb 2008
Posts: 5

PostPosted: Sat Feb 09, 2008 11:58 pm    Post subject: Problem with TAB Reply with quote

Hi shrisangeeta,
thanks for the good advice.
I've a problem with the code you posted: after a map is displayed, if you go on a TextInput and press the TAB key, you'll obtain a stange error:
Error #2025: The supplied DisplayObject must be a child of the caller

Any suggestion?
Back to top
View user's profile Send private message
shrisangeeta
AFC Member


Joined: 28 Jan 2008
Posts: 3

PostPosted: Mon Feb 11, 2008 4:48 am    Post subject: Reply with quote

hi,
in mine code i dont have any inuput text box........ i m not getting u about which textinput u saying abt.....

and whatever........ that is simple error u can reslove it.....
in flex builder .. make this mxml file as a "deafault page"...... and run... it will solve your ptoblem.
Back to top
View user's profile Send private message
a903888
AFC Member


Joined: 07 Feb 2008
Posts: 5

PostPosted: Mon Feb 11, 2008 11:05 am    Post subject: Error #2025: FocusManager clash using UMap in Flex !!! Reply with quote

There is a big problem using the UMap component under Flex. After a map is displayed, if you show an Alert (or display a popup), whenever you press the TAB key (even after the alert or popup is closed) you'll obtain the error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
This problem makes the component unusable in a normal application (I think that every application has at least an alert window !...)
Sad Sad Sad
See the attached code.
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
   creationComplete="onCreationComplete(event)" width="100%">
   <mx:Script>
   <![CDATA[
    import mx.events.CloseEvent;
    import mx.controls.PopUpButton;
    import mx.controls.TextInput;
    import mx.containers.TitleWindow;
    import mx.managers.PopUpManager;
    import mx.core.UIComponent;
    import mx.controls.Alert;
    import com.afcomponents.umap.core.UMap;
    import com.afcomponents.umap.types.*;
     
    public function onCreationComplete(event:Event) : void
    {
            var ref : UIComponent = new UIComponent();
            mapCanvas.addChild(ref);
            var gmap:UMap = new UMap();
            gmap.setSize(300, 300);
            gmap.setCenter(new LatLng(23.402765, 77.871094),4);
            ref.addChild(gmap);
    }

   private function showPopup():void {
      var tw:TitleWindow = new TitleWindow();
      tw.title="press TAB to get the error";
      tw.showCloseButton=true;
      tw.addChild(new TextInput());
      tw.addEventListener(CloseEvent.CLOSE,closePopup);
      PopUpManager.addPopUp(tw,this,true);
      PopUpManager.centerPopUp(tw);
   }
   
   private function closePopup(event:Event):void {
      PopUpManager.removePopUp(TitleWindow(CloseEvent(event).currentTarget));   
   }

      ]]>
   </mx:Script>
   <mx:VBox>
      <mx:Canvas id="mapCanvas" width="400" height="300" backgroundColor="#352D69" x="6" y="10"/>
         <mx:Button label="Test Alert" click="Alert.show('Press TAB to get the error #2025')" />
         <mx:Button label="Test Popup" click="showPopup()" />
         
   </mx:VBox>
</mx:Application>
Back to top
View user's profile Send private message
dvs_code
AFC Team


Joined: 09 May 2006
Posts: 2131

PostPosted: Tue Feb 12, 2008 7:38 am    Post subject: Reply with quote

That's the issue with Flash and Flex having different focus managers. Just deactivate the UMap's focus manager after it has been defined:

Code:
private var gmap:UMap;
   
   public function onCreationComplete(event:Event) : void
   {
   
      var ref:UIComponent = new UIComponent();
      mapCanvas.addChild(ref);
      gmap = new UMap();
      gmap.setSize(300, 300);
      gmap.setCenter(new LatLng(23.402765, 77.871094),4);
      ref.addChild(gmap);
      
      setTimeout(deactivateFocusMananger, 1);
   }
   
   private function deactivateFocusMananger():void
   {
      gmap.focusManager.deactivate();
   }


Thanks user volk for this tip!

http://www.afcomponents.com/forum/viewtopic.php?p=10699#10699
_________________
Dmitry Stolyarov
AFC Team
Back to top
View user's profile Send private message Visit poster's website
a903888
AFC Member


Joined: 07 Feb 2008
Posts: 5

PostPosted: Wed Feb 13, 2008 2:26 pm    Post subject: Thx very very much Reply with quote

...it seems to work fine, now !! Very Happy
Back to top
View user's profile Send private message
karkara
AFC Member


Joined: 24 Aug 2007
Posts: 9

PostPosted: Sat Apr 19, 2008 3:04 pm    Post subject: Customize ZommControl Reply with quote

Hello,

How can i customize ZoomControl position and size in Flex? Is it possible? all the things i found about customizing it was for flash. I´m using the Umap in a small size, so the controlers get out of the map. I need it smaller.

Thanks
Back to top
View user's profile Send private message
jtamayo
AFC Member


Joined: 27 Jan 2008
Posts: 6

PostPosted: Wed Apr 23, 2008 2:15 am    Post subject: Using UMAP with Flex Builder 2 Reply with quote

The map, for a lack of a better term, bleeds from the canvas and covers the entire browser screen.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="onCreationComplete(event)" >

<mx:Script>
<![CDATA[

import com.afcomponents.umap.gui.*;
import com.afcomponents.umap.core.UMap;
import mx.core.UIComponent;
import com.afcomponents.umap.types.LatLng;

private var map:UMap;

public function onCreationComplete(event:Event) : void
{
var ref:UIComponent = new UIComponent();

map = new UMap();
map.setSize(300, 300);

//Set center of map
map.setCenter(new LatLng(28.439714, -81.826172), 6);

ref.addChild(map);
mapCanvas.addChild(ref);
ref.focusManager.deactivate();

map.addControl(new MapTypeControl());
map.addControl(new ZoomControl());
map.addControl(new PositionControl());
}
]]>
</mx:Script>

<mx:HBox>
<mx:Canvas id="mapCanvas" width="600" height="400" backgroundColor="#352D69" x="114" y="238"/>
</mx:HBox>

<mx:VBox x="41" y="424" height="160" width="313">
<mx:DataGrid x="10" y="408">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
<mx:DataGridColumn headerText="Column 2" dataField="col2"/>
<mx:DataGridColumn headerText="Column 3" dataField="col3"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>


</mx:Application>
Back to top
View user's profile Send private message
dvs_code
AFC Team


Joined: 09 May 2006
Posts: 2131

PostPosted: Wed Apr 23, 2008 5:23 am    Post subject: Reply with quote

What Flex version are you using?
_________________
Dmitry Stolyarov
AFC Team
Back to top
View user's profile Send private message Visit poster's website
dvs_code
AFC Team


Joined: 09 May 2006
Posts: 2131

PostPosted: Wed Apr 23, 2008 5:39 am    Post subject: Reply with quote

Somehow the mask of the component was eleminated. You need to recreate the mask for the container UIComponent object:

Code:
var maskSprite:Sprite = new Sprite();
maskSprite.graphics.beginFill(0xff0000, 0.3);
maskSprite.graphics.drawRect(0,0,300,300);
ref.mask = maskSprite;

_________________
Dmitry Stolyarov
AFC Team
Back to top
View user's profile Send private message Visit poster's website
jtamayo
AFC Member


Joined: 27 Jan 2008
Posts: 6

PostPosted: Wed Apr 23, 2008 4:09 pm    Post subject: Reply with quote

Thanks Dmitry, your solution works well. By the way I'm using Adobe Flex Builder 2 version 2.0.1
Back to top
View user's profile Send private message
cjbraden
AFC Member


Joined: 08 May 2008
Posts: 1

PostPosted: Fri May 09, 2008 12:11 am    Post subject: Getting an error loading skin Reply with quote

Hi, I'm using Flex 2.0.1. I added the SWC to my library, and implemented the MXML example code and get the following error. Anyone seen this?

Error: MapTypeControl > error loading skins
at com.afcomponents.umap.gui::MapTypeControl/com.afcomponents.umap.gui:MapTypeControl::createChildren()
at com.afcomponents.umap.abstract::UIMapControl$iinit()
at com.afcomponents.umap.gui::MapTypeControl$iinit()
at trailuser/onCreationComplete()
at trailuser/___Application1_creationComplete()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/set initialized()
at mx.managers::LayoutManager/::doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/::callLaterDispatcher2()
at mx.core::UIComponent/::callLaterDispatcher()
Back to top
View user's profile Send private message
guym
AFC Space Explorer


Joined: 09 Apr 2008
Posts: 11

PostPosted: Thu Jul 31, 2008 9:59 pm    Post subject: Error loading skins Reply with quote

I get the same error. Flex Builder 2.01. I'm creating an MXML component based on the example code here and this is the error I get:

Main Thread (Suspended: Error: ZoomControl > error loading skins)
com.afcomponents.umap.gui::ZoomControl/createChildren [no source]
com.afcomponents.umap.abstract::UIMapControl [no source]
com.afcomponents.umap.gui::ZoomControl [no source]

etc

I'm guessing either the swc file needs to be in some particular location...? Are the skins defined somewhere we don't know about?
Back to top
View user's profile Send private message
guym
AFC Space Explorer


Joined: 09 Apr 2008
Posts: 11

PostPosted: Mon Aug 04, 2008 12:56 am    Post subject: Fix for error loading skins Reply with quote

I discovered, by reading the link provided at the top of this thread, that you need to install a patch to make FB2 able to use Flash CS3 components. Go to the first post and follow the instructions and it will fix the "error loading skins" problem.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> UMap ActionScript 3.0 All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group