How to access component's control from main .mxml file?
I have a main .mxml while in which i imported custom
"popUpWindow" component using "import components.popUpWindow"
statement. In main .mxml file I display later on that component as
popUp window using popUp manager class:
var popUpWin:IFlexDisplayObject;
popUpWin = PopUpManager.createPopUp(this, popUpWindow, true);
Once component is displayed, how can i access using
actionscript component's TextInput control (specifically its .text
property) from my main .mxml file?
thanks
msabljic , sounds like you ran into the same problem as me,
perhaps... I posted a question similar to yours around the same
time. Take a look at the responses I got and maybe that will help
answer your question.
Here's a link to the post
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1285775&enterthread=y
Similar Messages
-
How to access component's control property from main .mxml file
I have a main .mxml while in which i imported custom
"popUpWindow" component using "import component.popUpWindow"
statement. In main .mxml file I display later on that component as
popUp window using popUp manager class. Once component is
displayed, how can i access using actionscript component's
TextInput control (specifically its .text property) from my main
.mxml file?
thanksI posted this answer elsewhere, maybe it will help:
First, save the new component wherever you keep your
components, let's say you call it "MyPopWindow.mxml"
Assign public variables for the string in both the main app
and the popup.
In your case, in the main app:
Code:
public var myText:String = "whatever the text field should
say.";
and then in the pop up mxml:
Code:
[Bindable]
public var myText;
Then, in the main mxml file:
Code:
// define the window type
private var popWin:MyPopWindow;
private function popMeUp(event:MouseEvent):void{
popWin =MyPopWindow(PopUpManager.createPopUp(this,
MyPopWindow, true));
popWin.myText = myText;
The important things here to notice is the name of the
component (i.e. the file) is used. A variable is created for the
window, and TYPED to your file name. Then you use the constructor
you already had, but again use your type. The "true" is optional
and gives you a modal popup window.
Lastly, assign the variable in the window (I called mine
popWin) to the variable in the main file you want to pass. -
Custom component calling function from main.mxml
I have a main.mxml that has the following function in it:
public function SubChooseField(evt:Event):void{
Alert.show( "Sub has been chosen" );
main.mxml also places the following custom component:
<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="
http://www.adobe.com/2006/mxml"
width="180" close="parent.SubChooseField(event)">
<mx:dataProvider>
<mx:Object data="1" label="choice 1 />
<mx:Object data="2" label="choice 2" />
<mx:Object data="3" label="choice 3" />
</mx:dataProvider>
</mx:ComboBox>
I want it so that when you chose one of the options in the
comboBox, it will call the function SubChooseField in the
main.mxml. But when I compile this, no matter what i try, i get the
error:
Error: Call to a possibly undefined method SubChooseField
through a reference with static type my_custom_opponent.
OR if i change the codeand remove the 'parent' to say:
close="SubChooseField(event)"> i get error:
Error: Call to a possibly undefined method SubChooseField.
any help much appreciated.Rather than trying to use parent, using events might help
here. In your main mxml file, just listen for the change event that
is dispatched from your custom component. Since it is a ComboBox
component, it automatically dispatches this event. If your
component was more complex, you would need to dispatch a custom
event.
If your custom component was named CustomCombo, then the mxml
in your main file would look something like this:
<ns1:CustomCombo id="cb" x="70" y="39" width="160"
change="SubChooseField(event)"/>
Vygo -
How to access MainPage.xaml controls from another page
i have an image element in the MainPage.xaml and a flyout in SettingsContract1.xaml, when the flyout item is clicked the filepicker is
opened and i want to set them image source of the image in the Mainpage with the file picked from the filepicker. How can i access the image from SettingsContract1.xaml
image in MainPage.xaml
<Image x:Name="img" HorizontalAlignment="Left" Height="332" VerticalAlignment="Top" Width="778" Margin="349,406,0,0"/>
menuflyout sub in SettingsContract1.xaml.vb
Private Sub chooseFile_Click(sender As Object, e As RoutedEventArgs) Handles chooseFile.Click
Dim filePicker As FileOpenPicker
filePicker = New FileOpenPicker()
filePicker.ViewMode = PickerViewMode.Thumbnail
filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary
filePicker.FileTypeFilter.Add(".png")
Dim file As StorageFile = Await filePicker.PickSingleFileAsync()
Using filestream As Streams.IRandomAccessStream = Await file.OpenAsync(FileAccessMode.Read)
Dim bitmapImage As Windows.UI.Xaml.Media.Imaging.BitmapImage = New BitmapImage
bitmapImage.SetSource(filestream)
img.Source = bitmapImage 'gives an error
End Using
End SubFound the answer from stackoverflow
Private Async Sub chooseFile_Click(sender As Object, e As RoutedEventArgs) Handles chooseFile.Click
Dim mapImage As Frame = Window.Current.Content
Dim mainPage As MainPage = mapImage.Content
Dim filePicker As FileOpenPicker
filePicker = New FileOpenPicker()
filePicker.ViewMode = PickerViewMode.Thumbnail
filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary
filePicker.FileTypeFilter.Add(".png")
Dim file As StorageFile = Await filePicker.PickSingleFileAsync()
Using filestream As Streams.IRandomAccessStream = Await file.OpenAsync(FileAccessMode.Read)
Dim bitmapImage As Windows.UI.Xaml.Media.Imaging.BitmapImage = New BitmapImage
bitmapImage.SetSource(filestream)
mainPage.img.Source = bitmapImage
End Using
End Sub -
Calling a component from a the main.mxml file
How do I call a component from a the main.mxml file?
<mx:Button id="btnNew" label="Launch Component " click="getComponent()" />
main.mxml (Has the button, that I would like to launch getcomponent.mxml)
getcomponent.mxml (The file I would like to call) (This file also has the ViewStack)
For some reasoning it's not seeing the bpVS(view stack id). I'm getting Access of undefined property bpVS error.
<!-- Main.mxml -->
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:components="components.*"
width="100%"
height="100%"
minHeight="0"
backgroundAlpha="0">
<mx:Script>
<![CDATA[
private function getComponent():void{
bpVS.selectedIndex = 1;
]]>
</mx:Script>
<!-- GetComponent.mxml -->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:view="components.view.*">
<mx:ViewStack id="bpVS"
top="69" left="180.5"
width="100%" height="100%"
resizeEffect="Resize"
moveEffect="Move" showEffect="Fade"
hideEffect="Fade">
</mx:ViewStack>
<mx:VBox id="vbTB" top="69" verticalGap="0">
<mx:ToggleButtonBar
id="payTB"
direction="vertical"
dataProvider="{bpVS}"
width="180" useHandCursor="true" buttonMode="true""
resizeEffect="Resize"
moveEffect="Move" showEffect="Fade" hideEffect="Fade" >
</mx:ToggleButtonBar>
</mx:VBox>
Thank youIt won't see it just by creating the namespace that contains it. There has to actually be an instance of it in the application. So in your case, your main application file (lets call it MyApp.mxml) would look something like this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:components="components.*">
<components:Main id="main"/>
<components:GetComponent id="getComp"/>
</mx:Application>
Then, you can reach down (mind you this isn't best practice) into those components to access their public properties. In a script block in MyApp.mxml, you could access the VBox with getComp.vbTB.
I don't know the ins and outs of your application, but perhaps Main is the main application, so then you would add GetComponent as a child of it instead of both Main and GetComponent being child components of the MyApp application. Does that clear up the confusion? -
How to access my macbook pro from a windows pc?
how to access my macbook pro from a windows pc?
Depending on what you mean by "access" the following may help:
File sharing: How to connect with File Sharing on your Mac - Apple Support
One way (and there are others) for remote control and remote access between Mac and Windows: http://www.teamviewer.com/en/index.aspx -
How do i seperate media browser from main window in Pro X
How do i separate media browser from main window in Pro X, it only lets me drag project audio tab from main window..
Regards
James.hello, this is usually caused by adware on your pc.
please run a scan of your system with [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] & also manually check that you don't have any suspicious entries like 3rd-party-toolbars presently installed under ''firefox > addons > extensions'' (adware like babylon also might install some unwanted stuff that comes under the names "Browser Manager", "Browser Protector", "Bprotector", "Object Installer", etc.) or in the windows control panel > programs section.
afterwards install the search reset addon - it will revert the most common customziations those adware programs do in firefox back to the default: https://addons.mozilla.org/firefox/addon/searchreset/
[[Remove a toolbar that has taken over your Firefox search or home page]] -
How to access a web service from a XLet
Hello,
I am new in software development to ITV and I dint find too many usefull information teaching how to access a web service from a XLet running in a STB. Are there anybody who can give me some help, maybe sample or tutorial?
Gratefull
Davidhi,
you can "borrow" the source code from [Yambo a free soft open source presentation engine (AKA XML microbrowser Xlet )|http://www.cineca.tv/labs/mhplab/index-en.html] both local and on a http remote connection.
hope it helps..
bye
andrea -
How to access internal table data from webdynpro to Flex application.
Hi Connoisseur
The data transfer from Abap WebDeypro to flex island works well. I followed , there is an example from Thomas Jung (by the way as always Great Work) and Karthikeyan Venkatesan (Infosys) but this example covers simple type only.
There is no example with complex types like arrayCollection which handle the transfer of data from flex to WebDynpro.
i tried to do pass internal table value to flex-datagrid.but its not work.
i would like to know
1.how to access internal table data from webdynpro to Flex application.
2.how to pass the internal table to flex-datagrid.
2.how to pass dynamically in ADOBE flex.
3. how to do Flex is receiving the wd context data?
4. how can we update WD context with FLEX data.
Ple give me sample example and step by step procedure.
Regards
laxmikanthHi Laxmikanth,
Please refer this...
Flash island: update complex type from flex
Cheers..
kris. -
Calling a function in main mxml file from a component
I have a main mxml file for an application.
Within that file I have a viewStack with 3 components which
are in separate mxml files.
I have a function written in Action Script in the main
application that I want to call from the 3 components.
How is this done?
Ta
MikeThanks for the help. I got it working using ntsiii's method
(which is more straight forward but maybe not good practice?)
though the line
private var _appMain:Application = Application.application
gave me the error message:
1118: Implicit coercion of a value with static type Object to
a possibly unrelated type mx.core:Application.
So i changed it to:
private var _appMain:* = Application.application
Which made it work, I don't really understand why.
Thanks
Mike -
OOABAP-How to access the protected methos from a class
How to access the protected methos from a class..There is a built in class..For tht class i have created a object..
Built in class name : CL_GUI_TEXTEDIT
method : LIMIT_TEXT.
How to access this..help me with codehi,
If inheritance is used properly, it provides a significantly better structure, as common components only
need to be stored once centrally (in the superclass) and are then automatically available to subclasses.
Subclasses also profit immediately from changes (although the changes can also render them invalid!).
Inheritance provides very strong links between the superclass and the subclass. The subclass must
possess detailed knowledge of the implementation of the superclass, particularly for redefinition, but also in
order to use inherited components.
Even if, technically, the superclass does not know its subclasses, the
subclass often makes additional requirements of the superclass, for example, because a subclass needs
certain protected components or because implementation details in the superclass need to be changed in
the subclass in order to redefine methods.
The basic reason is that the developer of a (super)class cannot
normally predict all the requirements that subclasses will later need to make of the superclass.
Inheritance provides an extension of the visibility concept: there are protected components. The visibility of
these components lies between that of the public components (visible to all users, all subclasses, and the class itself), and private (visible only to the class itself). Protected components are visible to and can be used by all subclasses and the class itself.
Subclasses cannot access the private components particularly attributes) of the superclass. Private
components are genuinely private. This is particularly important if a (super)class needs to make local
enhancements to handle errors: it can use private components to do this without knowing or invalidating
subclasses.
Create your class inse24 and inherit this CL_GUI_TEXTEDIT
class in yours. You can then access the protected methods.
Hope this is helpful, <REMOVED BY MODERATOR>
Edited by: Runal Singh on Feb 8, 2008 1:08 PM
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 2:19 PM -
Don't know how to access my email away from home
i don't know how to access my email away from home.
can't find webmail or email options.
== User Agent ==
Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.1; AOLBuild 4334.5009; Windows NT 6.0; Trident/4.0; GTB6.3; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618)Somehow I got it to work, a whole lot easier than i thought, kind of scary how easy... but Im not exactly sure what of several things is how I got it. Scariest thing; watching my iBook I wouldn't know that I was accessing it from the MB. It's only me doing it, but still seems so easy.
If I have a WPA2 password protected wireless network do I have to worry that others can access it so easily? (not that I have anything interesting, it's just the general privacy paranoia) -
Passing a variable from an mxml component to the main mxml file
Hey guys,
I have a popup titlewindowt which is defined as a component in a separate mxml component file.
In the popup window i have an inputbox and a button
When i press the button in that popup window i want the text in the input box to be transfered across to a variable in my main mxml file
How can i do this?
Thanks
ChrisSince you are already tied in to the top level application then I would add a listener at the application level and in the component do a:
FlexGlobals.topLevelApplication.dispatchEvent(....)
However, I can't help but encourage you to decouple this functionality and pass events around rather than what you are currently doing.
There are a few ways you can do this. One is to use an MVC framework to model your application after.
A simpler approach even would be to have the component simploy dispatch events to itself and have whatever is creating the component listen for the events and do higher level functionality.
Good Luck! -
How to access the abap program from MS Excel?
Hi ,
How to access the abap program from MS Excel or MS access ?
The abap program "z..." has the below input and output attributes
Input : Date,Index and file name with location (.htm or .xls)
Output : htm or xls file downloaded at the above location.
Please help me here.Do we haev to use BAPI and RFC?If yes,please tell me how to use them
Regards
DineshMaybe this could help you up -;)
[Simple SE38 Emulator using Microsoft Excel|Simple SE38 Emulator using Microsoft Excel]
Greetings,
Blag. -
How to invert vertical slide control from top-down to bottom-up style?
How to invert vertical slide control from top-down to bottom-up style?
Actually vertical slide control has default style as the below image:
I want it to be something like this:
Sorry for my bad photoshop skillThanks a lot !!!
It's what I didn't know
Maybe you are looking for
-
How to change posting period for a company code
Hi Gurus, In MIGO while doing goods receipt i get this error " Posting only possible in periods 2006/05 and 2006/04 in company code 3000" How to change the posting period. I have serched in SDN, i tried transaction MMPV, and OB52 but i am not able to
-
For a while now I have been having trouble with pdf files in Mail. Sometimes I cannot even open them as they appear as a little black dot. The trouble came to a head recently when one of the pdf files I work with for some reason opened up without one
-
Linux Install (Opensuse 12.2) damage Bios in Lenovo G480
Hello, Actually I bought the Lenovo G480. Once Opensuse 12.2 was Installed, for some reason i cant enter to the Bios with F2... if I try with F12 show a lot of times "opensuse" and at last the Ethernet, HD and CD for boot. I cant find the bios for th
-
What is an "Accessorize Test" and how do I get out of it?
When I turned on my 30GB iPod it started doing these test things and I figured out how to do them. But this one I'm stuck on. It says: "Please plug FW LCD ID : 1 FWPWR : 0" Please Help!!!
-
IBook Mac OS 10.3.9 not booting, even crashing in single-user mode
Yeah so about 2 weeks ago my iBook started crashing, then wouldn't properly re-boot. Gradually, it would start crashing after being on for less and less time until now it gets just past the apple symbol and then freezes on a blue screen. I've been us