Question

Je suis un analyste SIG qui a été déplacé vers une position de programmeur d'analystes. Cela a été une transition difficile pour moi car je n'ai pas beaucoup d'antécédents de programmation, mais j'ai été jeté dedans.

Je travaille sur une application Flex à l'intérieur d'une page JSP. C'est essentiellement une grille 3x2 qui a des images et du texte. Ce que j'essaie de faire, c'est avoir plus d'une référence de titreswindows dans cette page, de sorte que lorsqu'une image a cliqué sur un titlewindow est ouverte. (Si quelqu'un a une meilleure idée, surtout si cela a à voir avec un vol stationnaire, je suis très ouvert à cela!) Je dois actuellement travailler pour une image. Cependant, lorsque j'essaie d'ajouter une deuxième fonction, c'est des erreurs sur moi. "Erreur 1021: Définition de la fonction en double" ci-dessous est l'intégralité du code de la page principale qui appelle le titrewindow. Le code ci-dessous est ce qui donne l'erreur 1021.

<?xml version="1.0" encoding="utf-8"?>

    <![CDATA[
        import flash.geom.Point;

        import mx.containers.TitleWindow;
        import mx.core.IFlexDisplayObject;
        import mx.managers.PopUpManager;

        import windows.SimplePopupWindow;   

        private var point1:Point = new Point();

        private function showWindow():void {
            var login:SimpleTitleWindowExample=SimpleTitleWindowExample(PopUpManager.createPopUp( this, SimpleTitleWindowExample , true));


            point1.x=131;
            point1.y=119;                
        point1=roadStatus.localToGlobal(point1);            
        }

        private var point2:Point = new Point();

        private function showWindow():void {
            var login:SimpleTitleWindowExampleFlood=SimpleTitleWindowExampleFlood(PopUpManager.createPopUp( this, SimpleTitleWindowExampleFlood , true));

            point2.x=289;
            point2.y=119;                
            point2=floodplain.localToGlobal(point2); 

        }           
    ]]>

</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:BorderContainer x="10" y="0" width="750" height="600" backgroundColor="#BBB082" backgroundAlpha="1.0" cornerRadius="20" borderColor="#E8DBA7">
    <s:Panel x="10" y="10" width="728" height="578" cornerRadius="20" chromeColor="#983D3A" borderColor="#F1EFE7" backgroundColor="#BBB082">
        <mx:Image x="131" y="119" width="150" height="115" source="file://GIS Map Portal/images/Map Images/SJCRoadStatus2_small.jpg" id="roadStatus" click="showWindow();"/>
        <mx:Image x="289" y="119" width="150" height="115" source="file://GIS Map Portal/images/Map Images/SJCRoadStatus_small.jpg" id="floodplain" click="showWindow();"/>
        <mx:Image x="447" y="119" width="150" height="115" source="file://GIS Map Portal/images/Map Images/SJCRoadStatus2_small.jpg"/>
        <s:Label x="131" y="242" text="SJC Road Status"/>
        <s:Label x="289" y="242" text="SJC Floodplain"/>
        <s:Label x="447" y="242" text="Assessor's Parcels"/>
        <mx:Image x="131" y="262" width="150" height="115" source="file://GIS Map Portal/images/Map Images/SJCRoadStatus_small.jpg"/>
        <mx:Image x="289" y="262" width="149" height="115" source="file://GIS Map Portal/images/Map Images/SJCRoadStatus2_small.jpg"/>
        <mx:Image x="446" y="262" width="151" height="115" source="file://GIS Map Portal/images/Map Images/SJCRoadStatus_small.jpg"/>
        <s:Label x="131" y="385" text="Label"/>
        <s:Label x="289" y="385" text="Label"/>
        <s:Label x="446" y="385" text="Label"/>
        <s:Label x="229" y="24" text="San Juan County Web Maps" fontFamily="Calvin and Hobbes" fontSize="25"/>

    </s:Panel>
</s:BorderContainer>

ci-dessous est le code titlewindow. Ce code fonctionne jusqu'à présent!

<?xml version="1.0" encoding="utf-8"?>

<mx:Script>
    <![CDATA[       
        import mx.managers.PopUpManager;
        import mx.controls.Text;

        // A reference to the TextInput control in which to put the result.
        public var loginName:Text;

        // Event handler for the OK button.
        private function returnName():void {
            //loginName.text="Name entered: " + userName.text; 
            PopUpManager.removePopUp(this);
        }
    ]]>
</mx:Script>

<mx:HBox width="323" height="147" borderColor="#E8DBA7" dropShadowVisible="true">
    <mx:Text text="The San Juan County GIS Department maintains aninteractive web map dedicated for researching county roads, but also includes city limits, lakes and rivers, and other geographic data.&#xd;" width="319" height="76" textAlign="center" color="#FFFFFF"/>
</mx:HBox>

<mx:HBox>
    <mx:Button label="Go" click="navigateToURL(new URLRequest(''), 'quote')"/>
    <mx:Button label="Back" click="PopUpManager.removePopUp(this);"/>
</mx:HBox>

question: Quel code dois-je modifier ci-dessus pour pouvoir ajouter plus d'un titrewindow (jusqu'à 6), ou quel code puis-je utiliser pour un vol stationnaire pour ouvrir une "fenêtre" ou une pointe d'outil?

Si quelqu'un a des idées ou peut me diriger du tout ce serait génial. Je l'apprécie!

Était-ce utile?

La solution

Sounds like you just got thrown in the deep end. Generally speaking theres no limitation on the number of title windows you can have open, the PopUpManager class handles any UIComponent you tell it to open as a pop up and one of the arguments for the .createPopUp or addPopUp static methods on the manager will take a modal parameter which specifies if the user interaction should be blocked (indicated by blurring the application) or if the window should just be shown. It seems rather this error is stemming from your extension of the TitleWindow (the SimpleTitleWindowExample) can you post that code. Also as starting points on the topic check out the following documentation:

General Flex:

http://www.adobe.com/devnet/flex/videotraining.html

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html

^ notice the runtimes and products selection options at the top of the screen, select according to SDK you're building with (or select SDK based on features)

PopUpManager: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/PopUpManager.html#createPopUp() http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/PopUpManager.html#addPopUp() http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/PopUpManager.html#removePopUp()

Tooltips: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/ToolTipManager.html#createToolTip() http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/ToolTipManager.html#destroyToolTip()

If you're still having troubles definitely post the code for the custom TitleWindow, also what version of the SDK you're using so I can try to replicate.

EDIT: Ah okay seeing the rest of your code clears it up... you can't have two functions that have the same exact name so in your code you have showWindow as a function that is declared two times (I'm not sure how this is getting past compilation, I would have imagined the compiler would be smart enough to see this error before run-time, but it is what it is). Change the other showWindow to be something like showOtherWindow or something along those lines. It also looks like you come from a procedural programming background (C or some other non-OOP language) Object Oriented programming takes a little while to get your head around but makes a whole lot more sense when it comes to solving real world problems once you understand it, basically you're setting up descriptions and sending messages between objects using method calls and when you define a class, via AS or MXML you're defining the methods (order of method/property definitions doesn't functionally matter, things are still procedural, like step by step within the methods but the order of method declaration or property declaration has no effect).

This may be helpful: http://www.codeproject.com/KB/architecture/OOP_Concepts_and_manymore.aspx

I'm basically at the opposite end of the spectrum in terms of skills, I have a formal education from DePaul University in computer science but at my current position am doing a lot of google maps flash code so I'm finding myself more and more needing to understand Datums and other GIS specialty info (just thought it was sort of interesting to find someone at the same intersection but going the other way :).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top