Member_2_4768634
asked on
How to use a function from another mxml?
Hello!
Please can somebody show me, how i can use a function which is defined in another mxml.
Here´s the example:
I have a application, where i can open a popup with a button click. This Button have´s a click event (click="eventListener(even t)"). eventListener is a function which include to save changed data in the popup and close it. Now everytime when i change data in the popup, i have to click the button in the main application to send the data and close the popup.
I want to store the button in the popup, but in the popup i don´t have the eventListener function, and so i get an eror.
Here´s the code.
Thank´s in advance!
Mario
Please can somebody show me, how i can use a function which is defined in another mxml.
Here´s the example:
I have a application, where i can open a popup with a button click. This Button have´s a click event (click="eventListener(even
I want to store the button in the popup, but in the popup i don´t have the eventListener function, and so i get an eror.
Here´s the code.
Thank´s in advance!
Mario
main.mxml
----------------------------
[Bindable]
private var _kundenDetails:kundenDetails;
private function eventListener(event:Event):void
{
switch(event.type)
{
case Event.CHANGE:
if (_kundenDetails)
{
_kundenDetails.anrede.text = dgUserRequest.selectedItem.anrede;
_kundenDetails.usernachname.text = dgUserRequest.selectedItem.usernachname;
_kundenDetails.username.text = dgUserRequest.selectedItem.username;
_kundenDetails.plz.text = dgUserRequest.selectedItem.plz;
_kundenDetails.ort.text = dgUserRequest.selectedItem.ort;
_kundenDetails.strasse.text = dgUserRequest.selectedItem.strasse;
_kundenDetails.tel_privat.text = dgUserRequest.selectedItem.tel_privat;
_kundenDetails.emailaddress.text = dgUserRequest.selectedItem.emailaddress;
_kundenDetails.userid.text = dgUserRequest.selectedItem.userid;
_kundenDetails.gebdatum.text = dgUserRequest.selectedItem.gebdatum;
_kundenDetails.beruf.text = dgUserRequest.selectedItem.beruf;
_kundenDetails.sonstiges.text = dgUserRequest.selectedItem.sonstiges;
_kundenDetails.dw_datum.text = dgUserRequest.selectedItem.dw_datum;
_kundenDetails.dw_bedienung.text = dgUserRequest.selectedItem.dw_bedienung;
_kundenDetails.dw_wickler.text = dgUserRequest.selectedItem.dw_wickler;
_kundenDetails.dw_anordnung.text = dgUserRequest.selectedItem.dw_anordnung;
_kundenDetails.dw_einwirkzeit.text = dgUserRequest.selectedItem.dw_einwirkzeit;
_kundenDetails.dw_nachbehandlung.text = dgUserRequest.selectedItem.dw_nachbehandlung;
_kundenDetails.dw_preis.text = dgUserRequest.selectedItem.dw_preis;
_kundenDetails.dw_anmerkungen.text = dgUserRequest.selectedItem.dw_anmerkungen;
_kundenDetails.image_url.source= dgUserRequest.selectedItem.image_url;
_kundenDetails.fa_datum.text = dgUserRequest.selectedItem.fa_datum;
_kundenDetails.fa_bedienung.text = dgUserRequest.selectedItem.fa_bedienung;
_kundenDetails.fa_rezeptur.text = dgUserRequest.selectedItem.fa_rezeptur;
_kundenDetails.fa_einwirkzeit.text = dgUserRequest.selectedItem.fa_einwirkzeit;
_kundenDetails.fa_preis.text = dgUserRequest.selectedItem.fa_preis;
_kundenDetails.fa_anmerkungen.text = dgUserRequest.selectedItem.fa_anmerkungen;
}
break;
case MouseEvent.CLICK:
if (event.target == detailsButton)
{
if (!_kundenDetails)
{
_kundenDetails = PopUpManager.createPopUp(
this, kundenDetails) as kundenDetails;
PopUpManager.centerPopUp(_kundenDetails);
if (dgUserRequest.selectedItem)
{
_kundenDetails.anrede.text = dgUserRequest.selectedItem.anrede;
_kundenDetails.usernachname.text = dgUserRequest.selectedItem.usernachname;
_kundenDetails.username.text = dgUserRequest.selectedItem.username;
_kundenDetails.plz.text = dgUserRequest.selectedItem.plz;
_kundenDetails.ort.text = dgUserRequest.selectedItem.ort;
_kundenDetails.strasse.text = dgUserRequest.selectedItem.strasse;
_kundenDetails.tel_privat.text = dgUserRequest.selectedItem.tel_privat;
_kundenDetails.emailaddress.text = dgUserRequest.selectedItem.emailaddress;
_kundenDetails.userid.text = dgUserRequest.selectedItem.userid;
_kundenDetails.gebdatum.text = dgUserRequest.selectedItem.gebdatum;
// _kundenDetails.gebdatum.selectedDate = dgUserRequest.selectedItem.gebdatum;
_kundenDetails.beruf.text = dgUserRequest.selectedItem.beruf;
_kundenDetails.sonstiges.text = dgUserRequest.selectedItem.sonstiges;
_kundenDetails.dw_datum.text = dgUserRequest.selectedItem.dw_datum;
_kundenDetails.dw_bedienung.text = dgUserRequest.selectedItem.dw_bedienung;
_kundenDetails.dw_wickler.text = dgUserRequest.selectedItem.dw_wickler;
_kundenDetails.dw_anordnung.text = dgUserRequest.selectedItem.dw_anordnung;
_kundenDetails.dw_einwirkzeit.text = dgUserRequest.selectedItem.dw_einwirkzeit;
_kundenDetails.dw_nachbehandlung.text = dgUserRequest.selectedItem.dw_nachbehandlung;
_kundenDetails.dw_preis.text = dgUserRequest.selectedItem.dw_preis;
_kundenDetails.dw_anmerkungen.text = dgUserRequest.selectedItem.dw_anmerkungen;
_kundenDetails.image_url.source= dgUserRequest.selectedItem.image_url;
_kundenDetails.fa_datum.text = dgUserRequest.selectedItem.fa_datum;
_kundenDetails.fa_bedienung.text = dgUserRequest.selectedItem.fa_bedienung;
_kundenDetails.fa_rezeptur.text = dgUserRequest.selectedItem.fa_rezeptur;
_kundenDetails.fa_einwirkzeit.text = dgUserRequest.selectedItem.fa_einwirkzeit;
_kundenDetails.fa_preis.text = dgUserRequest.selectedItem.fa_preis;
_kundenDetails.fa_anmerkungen.text = dgUserRequest.selectedItem.fa_anmerkungen;
}
}
else
{
PopUpManager.removePopUp(_kundenDetails);
_kundenDetails = null;
userRequest.send();
}
}
break;
}
}
<mx:Button click="eventListener(event)" id="detailsButton" label="{(_kundenDetails == null) ? 'Zeige Details' : 'Details ausblenden'}" x="0" y="10" fontSize="11"/>
ASKER
Thank you for the answer.
I have modified the Button in the Popup as follow, but when i click this button in the popup i get an error.
ReferenceError: Error #1069: Property detailsButton not found on main and there is no default value.
at kundenDetails/__detailsBut ton_click( )[/Users/m b/Document s/Flex Builder 3/Kundenverwaltung/src/kun denDetails .mxml:267]
I have modified the Button in the Popup as follow, but when i click this button in the popup i get an error.
ReferenceError: Error #1069: Property detailsButton not found on main and there is no default value.
at kundenDetails/__detailsBut
<mx:Button click="this.parentApplication.detailsButton.dispatchEvent(new Event(Event.CHANGE))" id="detailsButton" label="{(this.parentApplication._kundenDetails == null) ? 'Zeige Details' : 'Details ausblenden'}" x="0" y="10" fontSize="11"/>
Sorry there seems to be a confusion in the understanding, I thought that there were two buttons one (detailsButton) on main.xml and the other button inside popup.
I thought u wanted to delegate the call from popups button click to the main button click. Please let me know if this is what you needed.
I thought u wanted to delegate the call from popups button click to the main button click. Please let me know if this is what you needed.
ASKER
No no, you have understood right.
In the main.mxml i have this Button - he work´s fine. Now i want to have this same Button, with the same function in the Popup.
Thank´s!
In the main.mxml i have this Button - he work´s fine. Now i want to have this same Button, with the same function in the Popup.
Thank´s!
then do one think don't modify any thing in you main .mxml, add a dummy button like save in your popup
like this
<mx:Button click="this.parentApplicat ion.detail sButton.di spatchEven t(new Event(Event.CHANGE))" id="save" x="0" y="10" fontSize="11"/>
this will automatically invoke the same click as clicking the detailsbutton.
like this
<mx:Button click="this.parentApplicat
this will automatically invoke the same click as clicking the detailsbutton.
ASKER
I get the same error as before.
ReferenceError: Error #1069: Property detailsButton not found on main and there is no default value.
at kundenDetails/__save_click ()[/Users/ marioboro/ Documents/ Flex Builder 3/Kundenverwaltung/src/kun denDetails .mxml:267]
ReferenceError: Error #1069: Property detailsButton not found on main and there is no default value.
at kundenDetails/__save_click
Please see the attached files :)
Hmm mxml is not allowed in attachment
ok here is the code
ok here is the code
testpopUp.mxml
-------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.PopUpManager;
[Bindable]
private var _kundenDetails:kundenDetails;
public function showPopUp():void{
_kundenDetails = PopUpManager.createPopUp(
this, kundenDetails) as kundenDetails;
PopUpManager.centerPopUp(_kundenDetails);
}
public function clickEvent(event:Event):void
{
Alert.show("Clicked");
if (event.target == detailsButton)
{
}
}
]]>
</mx:Script>
<mx:Button x="78" y="40" id="detailsButton" label="Button" click="clickEvent(event)"/>
<mx:Button x="78" y="150" label="show PopUp" click="showPopUp()"/>
</mx:Application>
kundenDetails.mxml
--------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300">
<mx:Script>
<![CDATA[
public function delegateCall():void
{
var app:testpopUp = this.parentApplication as testpopUp;
app.clickEvent(new Event(Event.CHANGE));
}
]]>
</mx:Script>
<mx:Button x="29" y="23" label="Button" click="delegateCall()"/>
</mx:TitleWindow>
ASKER
Thank you, but anything i do wrong ... I can´t get it work. Please can you show it in my code?
Thank´s for your patience.
Thank´s for your patience.
MAIN APPLICATION (kunden.mxml)
----------------------------------
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="962" height="650" xmlns="*" creationComplete="send_data()">
<mx:Style source="global.css"/>
<mx:Script>
import mx.managers.PopUpManager;
import mx.utils.StringUtil;
private function refilter():void
{
filter.text = StringUtil.trim(filter.text.toLowerCase());
if( filter.text.length == 0)
userRequest.lastResult.users.user.filterFunction = null;
else
userRequest.lastResult.users.user.filterFunction = filterCompany;
userRequest.lastResult.users.user.refresh();
}
private function filterCompany( e:Object):Boolean
{
if( String(e.usernachname).toLowerCase().indexOf( filter.text) != -1)
return true;
return false;
}
private function send_data():void {
userRequest.send();
}
[Bindable]
private var _kundenDetails:kundenDetails;
private function eventListener(event:Event):void
{
switch(event.type)
{
case Event.CHANGE:
if (_kundenDetails)
{
_kundenDetails.anrede.text = dgUserRequest.selectedItem.anrede;
_kundenDetails.usernachname.text = dgUserRequest.selectedItem.usernachname;
_kundenDetails.username.text = dgUserRequest.selectedItem.username;
_kundenDetails.plz.text = dgUserRequest.selectedItem.plz;
_kundenDetails.ort.text = dgUserRequest.selectedItem.ort;
_kundenDetails.strasse.text = dgUserRequest.selectedItem.strasse;
_kundenDetails.tel_privat.text = dgUserRequest.selectedItem.tel_privat;
_kundenDetails.emailaddress.text = dgUserRequest.selectedItem.emailaddress;
_kundenDetails.userid.text = dgUserRequest.selectedItem.userid;
_kundenDetails.gebdatum.text = dgUserRequest.selectedItem.gebdatum;
_kundenDetails.beruf.text = dgUserRequest.selectedItem.beruf;
_kundenDetails.sonstiges.text = dgUserRequest.selectedItem.sonstiges;
_kundenDetails.dw_datum.text = dgUserRequest.selectedItem.dw_datum;
_kundenDetails.dw_bedienung.text = dgUserRequest.selectedItem.dw_bedienung;
_kundenDetails.dw_wickler.text = dgUserRequest.selectedItem.dw_wickler;
_kundenDetails.dw_anordnung.text = dgUserRequest.selectedItem.dw_anordnung;
_kundenDetails.dw_einwirkzeit.text = dgUserRequest.selectedItem.dw_einwirkzeit;
_kundenDetails.dw_nachbehandlung.text = dgUserRequest.selectedItem.dw_nachbehandlung;
_kundenDetails.dw_preis.text = dgUserRequest.selectedItem.dw_preis;
_kundenDetails.dw_anmerkungen.text = dgUserRequest.selectedItem.dw_anmerkungen;
_kundenDetails.image_url.source= dgUserRequest.selectedItem.image_url;
_kundenDetails.fa_datum.text = dgUserRequest.selectedItem.fa_datum;
_kundenDetails.fa_bedienung.text = dgUserRequest.selectedItem.fa_bedienung;
_kundenDetails.fa_rezeptur.text = dgUserRequest.selectedItem.fa_rezeptur;
_kundenDetails.fa_einwirkzeit.text = dgUserRequest.selectedItem.fa_einwirkzeit;
_kundenDetails.fa_preis.text = dgUserRequest.selectedItem.fa_preis;
_kundenDetails.fa_anmerkungen.text = dgUserRequest.selectedItem.fa_anmerkungen;
}
break;
case MouseEvent.CLICK:
if (event.target == detailsButton)
{
if (!_kundenDetails)
{
_kundenDetails = PopUpManager.createPopUp(
this, kundenDetails) as kundenDetails;
PopUpManager.centerPopUp(_kundenDetails);
if (dgUserRequest.selectedItem)
{
_kundenDetails.anrede.text = dgUserRequest.selectedItem.anrede;
_kundenDetails.usernachname.text = dgUserRequest.selectedItem.usernachname;
_kundenDetails.username.text = dgUserRequest.selectedItem.username;
_kundenDetails.plz.text = dgUserRequest.selectedItem.plz;
_kundenDetails.ort.text = dgUserRequest.selectedItem.ort;
_kundenDetails.strasse.text = dgUserRequest.selectedItem.strasse;
_kundenDetails.tel_privat.text = dgUserRequest.selectedItem.tel_privat;
_kundenDetails.emailaddress.text = dgUserRequest.selectedItem.emailaddress;
_kundenDetails.userid.text = dgUserRequest.selectedItem.userid;
_kundenDetails.gebdatum.text = dgUserRequest.selectedItem.gebdatum;
// _kundenDetails.gebdatum.selectedDate = dgUserRequest.selectedItem.gebdatum;
_kundenDetails.beruf.text = dgUserRequest.selectedItem.beruf;
_kundenDetails.sonstiges.text = dgUserRequest.selectedItem.sonstiges;
_kundenDetails.dw_datum.text = dgUserRequest.selectedItem.dw_datum;
_kundenDetails.dw_bedienung.text = dgUserRequest.selectedItem.dw_bedienung;
_kundenDetails.dw_wickler.text = dgUserRequest.selectedItem.dw_wickler;
_kundenDetails.dw_anordnung.text = dgUserRequest.selectedItem.dw_anordnung;
_kundenDetails.dw_einwirkzeit.text = dgUserRequest.selectedItem.dw_einwirkzeit;
_kundenDetails.dw_nachbehandlung.text = dgUserRequest.selectedItem.dw_nachbehandlung;
_kundenDetails.dw_preis.text = dgUserRequest.selectedItem.dw_preis;
_kundenDetails.dw_anmerkungen.text = dgUserRequest.selectedItem.dw_anmerkungen;
_kundenDetails.image_url.source= dgUserRequest.selectedItem.image_url;
_kundenDetails.fa_datum.text = dgUserRequest.selectedItem.fa_datum;
_kundenDetails.fa_bedienung.text = dgUserRequest.selectedItem.fa_bedienung;
_kundenDetails.fa_rezeptur.text = dgUserRequest.selectedItem.fa_rezeptur;
_kundenDetails.fa_einwirkzeit.text = dgUserRequest.selectedItem.fa_einwirkzeit;
_kundenDetails.fa_preis.text = dgUserRequest.selectedItem.fa_preis;
_kundenDetails.fa_anmerkungen.text = dgUserRequest.selectedItem.fa_anmerkungen;
}
}
else
{
PopUpManager.removePopUp(_kundenDetails);
_kundenDetails = null;
userRequest.send();
}
}
break;
}
}
</mx:Script>
<mx:TextInput x="802" y="10" change="refilter()" id="filter" editable="true" fontSize="11"/>
<mx:DataGrid change="eventListener(event)" id="dgUserRequest" x="0" y="53" dataProvider="{userRequest.lastResult.users.user}" width="962" height="593" click="eventListener(event)" styleName="userVorschau" fontSize="11">
<mx:columns>
<mx:DataGridColumn headerText="Nr." dataField="userid" width="35"/>
<mx:DataGridColumn headerText="Anrede" dataField="anrede" width="65"/>
<mx:DataGridColumn headerText="Nachname" dataField="usernachname" width="200"/>
<mx:DataGridColumn headerText="Vorname" dataField="username" width="110"/>
<mx:DataGridColumn headerText="Plz" dataField="plz" width="50"/>
<mx:DataGridColumn headerText="Ort" dataField="ort" width="190"/>
<mx:DataGridColumn headerText="Straße" dataField="strasse" width="200"/>
<mx:DataGridColumn headerText="Telefon Nr." dataField="tel_privat" width="110"/>
</mx:columns>
</mx:DataGrid>
<mx:HTTPService id="userRequest" url="http://localhost/kunden.php" useProxy="false" method="POST">
</mx:HTTPService>
<mx:Button click="eventListener(event)" id="detailsButton" label="{(_kundenDetails == null) ? 'Zeige Details' : 'Details ausblenden'}" x="0" y="10" fontSize="11"/>
<mx:Text x="703" y="12" text="Schnellsuche" fontWeight="bold" fontSize="11"/>
</mx:Module>
POPUP (kundenDetails.mxml)
----------------------------------
<mx:TitleWindow layout="vertical" xmlns:mx="http://www.adobe.com/2006/mxml" width="1024" height="768" xmlns="*" creationComplete="initApp();send_data()">
<mx:Style source="global.css"/>
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private function send_data():void {
userRequest.send();
}
]]>
</mx:Script>
<mx:Form x="0" y="0" width="100%" styleName="userDetails">
<mx:Canvas id="personenDaten" width="100%">
<mx:constraintColumns>
<mx:ConstraintColumn id="col1" width="0" />
<mx:ConstraintColumn id="col2" width="50%" />
<mx:ConstraintColumn id="col3" width="50%" />
</mx:constraintColumns>
<mx:Panel titleStyleName="kundenDetailsPanel" dropShadowEnabled="false" title="Angaben zur Person" width="400" height="100%" left="col2:0" paddingLeft="10" paddingBottom="10" paddingRight="10" paddingTop="10">
<mx:HBox>
<mx:Label text="Kunden Nr." textAlign="left" fontWeight="bold" width="100"/>
<mx:TextInput id="userid" text="id" editable="false" width="60"/>
</mx:HBox>
<mx:HRule width="358" strokeWidth="2" strokeColor="#0B333C"/>
<mx:HBox left="50" top="50">
<mx:Label text="Anrede" fontWeight="bold" width="100"/>
<mx:TextInput id="anrede" width="60"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Nachname" fontWeight="bold" width="100"/>
<mx:TextInput id="usernachname" width="250"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Vorname" fontWeight="bold" width="100"/>
<mx:TextInput id="username" width="250"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Plz/Ort" fontWeight="bold" width="100"/>
<mx:TextInput id="plz" width="60"/>
<mx:TextInput id="ort" width="182"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Straße" fontWeight="bold" width="100"/>
<mx:TextInput id="strasse" width="250"/>
</mx:HBox>
<mx:HRule width="358" strokeWidth="2" strokeColor="#0B333C"/>
<mx:HBox>
<mx:Label text="Tel. Privat" fontWeight="bold" width="100"/>
<mx:TextInput id="tel_privat" width="250"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="E-Mail" fontWeight="bold" width="100"/>
<mx:TextInput id="emailaddress" width="250"/>
</mx:HBox>
<mx:HRule width="358" strokeWidth="2" strokeColor="#0B333C"/>
<mx:HBox>
<mx:Label text="Geb. Datum" fontWeight="bold" width="100"/>
<mx:TextInput id="gebdatum" />
<!--<mx:DateField id="gebdatum" formatString="DD.MM.YYYY" yearNavigationEnabled="true" />-->
</mx:HBox>
<mx:HBox>
<mx:Label text="Beruf" fontWeight="bold" width="100"/>
<mx:TextInput id="beruf" width="250"/>
</mx:HBox>
<mx:HRule width="358" strokeWidth="2" strokeColor="#0B333C"/>
<mx:Text text="Sonstiges" fontWeight="bold" fontSize="11"/>
<mx:TextArea id="sonstiges" width="358" height="200"/>
<mx:HBox width="100%" horizontalAlign="center">
<mx:Button label="Speichern" id="submit" click="send_data()"/><mx:Button click="this.parentApplication.detailsButton.dispatchEvent(new Event(Event.CHANGE))" id="save" x="0" y="10" fontSize="11"/>
</mx:HBox>
</mx:Panel>
<mx:Panel titleStyleName="kundenDetailsPanel" dropShadowEnabled="false" title="Weitere Infos" height="100%" paddingLeft="10" paddingBottom="10" paddingRight="10" paddingTop="10" left="422" width="540">
<mx:HBox width="100%" horizontalAlign="left">
<mx:Image id="image_url" width="237" height="178"/>
<mx:VBox left="10" bottom="10" top="10" right="10">
<mx:List width="100%" id="listFiles" height="100%" allowMultipleSelection="true"/>
<mx:HBox width="100%" horizontalAlign="center">
<mx:Button label="Add file(s).." id="btnAdd" click="addFiles()"/>
<mx:Button label="Remove file(s)" id="btnRemove" click="removeFiles()"/>
</mx:HBox>
</mx:VBox>
<mx:ControlBar horizontalAlign="right">
<mx:Button label="Upload file(s)" id="btnUpload" click="startUpload(true)" enabled="false"/>
</mx:ControlBar>
</mx:HBox>
<mx:HRule width="100%" strokeWidth="2" strokeColor="#0B333C"/>
<mx:Accordion id="accordion" width="100%" height="100%" creationPolicy="all">
<mx:VBox label="Dauerwelle" fontSize="11" fontWeight="normal" paddingLeft="10" paddingBottom="10" paddingRight="10" paddingTop="10">
<mx:HBox>
<mx:Label text="Datum" fontWeight="bold" width="100"/>
<mx:TextInput id="dw_datum" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Bedient von" fontWeight="bold" width="100"/>
<mx:TextInput id="dw_bedienung" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Wicklerstärke" fontWeight="bold" width="100"/>
<mx:TextInput id="dw_wickler" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Anordnung" fontWeight="bold" width="100"/>
<mx:TextInput id="dw_anordnung" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Einwirkzeit" fontWeight="bold" width="100"/>
<mx:TextInput id="dw_einwirkzeit" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Nachbehandlung" fontWeight="bold" width="100"/>
<mx:TextInput id="dw_nachbehandlung" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Preis" fontWeight="bold" width="100"/>
<mx:TextInput id="dw_preis" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Anmerkungen" fontWeight="bold" width="100"/>
<mx:TextArea id="dw_anmerkungen" width="358" height="100"/>
</mx:HBox>
</mx:VBox>
<mx:VBox label="Farbe" fontSize="11" fontWeight="normal" paddingLeft="10" paddingBottom="10" paddingRight="10" paddingTop="10">
<mx:HBox>
<mx:Label text="Datum" fontWeight="bold" width="100"/>
<mx:TextInput id="fa_datum" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Bedient von" fontWeight="bold" width="100"/>
<mx:TextInput id="fa_bedienung" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Rezeptur" fontWeight="bold" width="100"/>
<mx:TextInput id="fa_rezeptur" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Einwirkzeit" fontWeight="bold" width="100"/>
<mx:TextInput id="fa_einwirkzeit" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Preis" fontWeight="bold" width="100"/>
<mx:TextInput id="fa_preis" width="358"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Anmerkungen" fontWeight="bold" width="100"/>
<mx:TextArea id="fa_anmerkungen" width="358" height="100"/>
</mx:HBox>
</mx:VBox>
</mx:Accordion>
</mx:Panel>
</mx:Canvas>
</mx:Form>
<mx:HTTPService id="userRequest" url="http://localhost/kunden.php" useProxy="false" method="POST">
<mx:request xmlns="">
<userid>{userid.text}</userid>
<anrede>{anrede.text}</anrede>
<username>{username.text}</username>
<usernachname>{usernachname.text}</usernachname>
<plz>{plz.text}</plz>
<ort>{ort.text}</ort>
<strasse>{strasse.text}</strasse>
<tel_privat>{tel_privat.text}</tel_privat>
<emailaddress>{emailaddress.text}</emailaddress>
<gebdatum>{gebdatum.text}</gebdatum>
<!-- <gebdatum>{gebdatum.selectedDate}</gebdatum> -->
<beruf>{beruf.text}</beruf>
<sonstiges>{sonstiges.text}</sonstiges>
<dw_datum>{dw_datum.text}</dw_datum>
<dw_bedienung>{dw_bedienung.text}</dw_bedienung>
<dw_wickler>{dw_wickler.text}</dw_wickler>
<dw_anordnung>{dw_anordnung.text}</dw_anordnung>
<dw_einwirkzeit>{dw_einwirkzeit.text}</dw_einwirkzeit>
<dw_nachbehandlung>{dw_nachbehandlung.text}</dw_nachbehandlung>
<dw_preis>{dw_preis.text}</dw_preis>
<dw_anmerkungen>{dw_anmerkungen.text}</dw_anmerkungen>
<fa_datum>{fa_datum.text}</fa_datum>
<fa_bedienung>{fa_bedienung.text}</fa_bedienung>
<fa_rezeptur>{fa_rezeptur.text}</fa_rezeptur>
<fa_einwirkzeit>{fa_einwirkzeit.text}</fa_einwirkzeit>
<fa_preis>{fa_preis.text}</fa_preis>
<fa_anmerkungen>{fa_anmerkungen.text}</fa_anmerkungen>
</mx:request>
</mx:HTTPService>
</mx:TitleWindow>
all you need to do is in your popup.xml where you are having this
<mx:Button click="this.parentApplicat ion.detail sButton.di spatchEven t(new Event(Event.CHANGE))" id="save" x="0" y="10" fontSize="11"/>
change it to
<mx:Script>
<![CDATA[
public function delegateCall():void
{
var app:kunden = this.parentApplication as kunden;
app.eventListener(new Event(Event.CHANGE));
}
]]>
</mx:Script>
<mx:Button click="delegateCall()" id="save" x="0" y="10" fontSize="11"/>
<mx:Button click="this.parentApplicat
change it to
<mx:Script>
<![CDATA[
public function delegateCall():void
{
var app:kunden = this.parentApplication as kunden;
app.eventListener(new Event(Event.CHANGE));
}
]]>
</mx:Script>
<mx:Button click="delegateCall()" id="save" x="0" y="10" fontSize="11"/>
ASKER
That have i try, but i get an error in this line: app.eventListener(new Event(Event.CHANGE));
what error???
ASKER
1195: Attempted access of inaccessible method eventListener through a
reference with static type kunden.
reference with static type kunden.
is it showing a red mark in the flexbuilder itself or you are getting a run time error?
Oh please make that method public :)
ASKER
OK, now that works ... but i get another error :) i´m sorry.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at kundenDetails/delegateCall ()[/Users/ marioboro/ Documents/ Flex Builder 3/Kundenverwaltung/src/kun denDetails .mxml:21]
at kundenDetails/__save_click ()[/Users/ marioboro/ Documents/ Flex Builder 3/Kundenverwaltung/src/kun denDetails .mxml:273]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at kundenDetails/delegateCall
at kundenDetails/__save_click
looks like something is null.
when you type app. in delegateCall() do you see the eventListener in the drop down?
Ideally parentApplciation can never be null.
when you type app. in delegateCall() do you see the eventListener in the drop down?
Ideally parentApplciation can never be null.
ASKER
sorry, in which drop down?
in the flex builder , when you are typing
app. (it displays a auto complete of the properties available on this object can you see eventListener in that list?)
if that visible then the event type you are sending may be wrong do you want change event or click event?
if click event you need to use MouseEvent.CLICK
app. (it displays a auto complete of the properties available on this object can you see eventListener in that list?)
if that visible then the event type you are sending may be wrong do you want change event or click event?
if click event you need to use MouseEvent.CLICK
ASKER
When im typing app. i see "eventListener(event.Event ):void".
I have also try "Mousevent.CLICK" --> i get the same error when i cklick the button in the popup.
Sorry for my bad knowledge, but i´m not a developer. I need the same button as in the main application. (click --> close popup --> change label in main application button)
Thank´s!
I have also try "Mousevent.CLICK" --> i get the same error when i cklick the button in the popup.
Sorry for my bad knowledge, but i´m not a developer. I need the same button as in the main application. (click --> close popup --> change label in main application button)
Thank´s!
hmm show me your current popup code.
ASKER
I never noted that you are using modules.
looks like the way parentApplication works for module is different let me see.
looks like the way parentApplication works for module is different let me see.
ASKER
OK, thank you.
I think the method should look like this where m1 is you moduleLoader's id. Please change that ID according to what you have named and try
public function delegateCall():void
{
var app:kunden = (m1.child as kunden);
app.eventListener(new Event(Event.CHANGE));
}
public function delegateCall():void
{
var app:kunden = (m1.child as kunden);
app.eventListener(new Event(Event.CHANGE));
}
ASKER
Thank you!
The id of my ModuleLodader is "myModKunden" (<mx:ModuleLoader id="myModKunden" url="kunden.swf" />)
I have modified your code to:
public function delegateCall():void
{
var app:kunden = (myModKunden.child as kunden);
app.eventListener(new Event(Event.CHANGE));
}
I get this error:
1120: Access of undefined property myModKunden
The id of my ModuleLodader is "myModKunden" (<mx:ModuleLoader id="myModKunden" url="kunden.swf" />)
I have modified your code to:
public function delegateCall():void
{
var app:kunden = (myModKunden.child as kunden);
app.eventListener(new Event(Event.CHANGE));
}
I get this error:
1120: Access of undefined property myModKunden
where have u defined your moduleloader , I think that will be in your main application
hence this will be
public function delegateCall():void
{
var app:{yourApplicationName} = this.parentApplication as {yourApplicationName} ;
var mod:kunden = (app.child as kunden);
mod.eventListener(new Event(Event.CHANGE));
}
hence this will be
public function delegateCall():void
{
var app:{yourApplicationName} = this.parentApplication as {yourApplicationName} ;
var mod:kunden = (app.child as kunden);
mod.eventListener(new Event(Event.CHANGE));
}
ASKER
Please look at the picture.
What has {yourApplicationName} to be?
What has {yourApplicationName} to be?
ASKER
I have forget the picture.
sample.gif
sample.gif
if your xml name is main.mxml
public function delegateCall():void
{
var app:main = this.parentApplication as main;
var mod:kunden = (app.child as kunden);
mod.eventListener(new Event(Event.CHANGE));
}
public function delegateCall():void
{
var app:main = this.parentApplication as main;
var mod:kunden = (app.child as kunden);
mod.eventListener(new Event(Event.CHANGE));
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nothing happen when i click the button.
public function delegateCall():void
{
var app:main = this.parentApplication as main ;
var mod:kunden = (app.myModKunden.child as kunden);
mod.eventListener(new Event(Event.CHANGE));
}
public function delegateCall():void
{
var app:main = this.parentApplication as main ;
var mod:kunden = (app.myModKunden.child as kunden);
mod.eventListener(new Event(Event.CHANGE));
}
dude trying putting a simple alert.show in the eventListener() to see if the call is getting delegated.
ASKER
I have put an Alert in the eventListener (kunden.mxml) but nothing happens.
public function eventListener(event:Event) :void
{
switch(event.type)
{
case Event.CHANGE:
if (_kundenDetails)
{
Alert.show();
public function eventListener(event:Event)
{
switch(event.type)
{
case Event.CHANGE:
if (_kundenDetails)
{
Alert.show();
ASKER
I don´t wanna burd you longer. I will give you now the 500 points.
I think it will be easier to change the popup into a viewstack. Then all functions are in the same application. I will open a new Thread. Please can you read it?
Thank´s a lot!
I think it will be easier to change the popup into a viewstack. Then all functions are in the same application. I will open a new Thread. Please can you read it?
Thank´s a lot!
ASKER
Thank´s!
this.parentApplication.det
if you want to directly call the parent application function from popup
this.parentApplication.det