How to access item renderer from main mxml?
Hi,
I have a datagrid which has item renderer. Code looks like this:
<mx:DataGrid id="newsfeedgrid" width="100%" height="100%" visible="true" verticalScrollPolicy="auto"
verticalGridLines="false" horizontalGridLines="true" horizontalGridLineColor="#E5F0F3" showHeaders="false"
rowHeight="70" wordWrap="true" resizableColumns="false">
<mx:columns>
<mx:DataGridColumn headerText="Image Name" dataField="imgname" width="100">
<mx:itemRenderer>
<mx:Component>
<mx:VBox height="100%" width="100%">
<!-- <mx:Image source="{data.imgname}" height="100%" width="100%"/>-->
<local:SmoothImage source="{'http://localhost/musicbook/attachdoc/'+data.imgname}" height="100%" width="100%"/>
<mx:Text text="{data.fname+' '+data.lname}" fontSize="10" fontWeight="bold" fontFamily="Verdana" color="#3D3636"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Messages" dataField="mymsg" wordWrap="true" resizable="true"
>
<mx:itemRenderer>
<mx:Component>
<mx:VBox verticalScrollPolicy="off" creationComplete="lbl_initialize()">
<!--<mx:HBox width="100%">
<mx:Text text="{data.uname}" width="100%" color="BLUE" fontSize="10" fontWeight="bold"
useHandCursor="true" buttonMode="true" mouseChildren="false"
click="this.outerDocument.userPage('msgFromC onnGrid')"/>
<mx:Text text="{data.actmsg}" width="100%" fontSize="10" fontWeight="bold"
/>
<mx:Text text="{data.secuname}" width="100%" color="BLUE" fontSize="10" fontWeight="bold"
useHandCursor="true" buttonMode="true" mouseChildren="false"
click="this.outerDocument.userPage('msgFromC onnGrid')"/>
</mx:HBox>-->
<mx:Text id="lbl" width="100%"
selectable="true"
link="lbl_link(event);" />
<!--<mx:ControlBar id="cbar">-->
<mx:Spacer height="50%"/>
<mx:HBox width="100%">
<mx:Text text="{data.datetime}" fontSize="7" color="#8B9698"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public var tempsecuname:String;
private function lbl_initialize():void {
/* if(lbl.text=="Pratik is good")
lbl.htmlText="<a href='event:flex.org'>Good</a> is Pratik";
//lbl.htmlText = "For more information on Flex, see <u><a href='event:flex.org'>http://www.flex.org/</a></u>.";
if(data.secuname==null)
tempsecuname = "";
else
tempsecuname=data.secuname;
lbl.htmlText="<a href='event:flex.org'><font color='#2112EF'><b>"+data.uname+"</b></font></a>"+data.actmsg+"<a href='event:flex.org'><font color='#2112EF'><b>"+tempsecuname+"</b></font></a>";
private function lbl_link(evt:TextEvent):void {
Alert.show(evt.toString(), evt.text);
switch (evt.text) {
case "flex.org":
// You clicked the flex.org link.
break;
]]>
</mx:Script>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
Problem currently is since lbl_initialize() function is called on creationComplete of Vbox, output displayed is not expected and when ever i navigate to grid page output gets changed and it is not proper.
I wanted to use text ,lbl, in my main.mxml so that i can assign the value when i am setting data provider.
Please help!!!
Thanks for your reply.. overriding set data in fact is a better approach and my half problem is solved but i am still facing some issues. Please find my code below:
<mx:DataGridColumn headerText="Messages" dataField="mymsg" wordWrap="true" resizable="true"
>
<mx:itemRenderer>
<mx:Component>
<mx:VBox verticalScrollPolicy="off" >
<mx:Text id="lbl" width="100%"
selectable="true"
link="lbl_link(event);" />
<!--<mx:ControlBar id="cbar">-->
<mx:Spacer height="50%"/>
<mx:HBox width="100%">
<mx:Text text="{data.datetime}" fontSize="7" color="#8B9698"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import mx.core.Application;
import mx.controls.Alert;
public var tempsecuname:String;
public var tempmsg:String="";
override public function set data( value:Object ) : void {
super.data = value;
lbl.htmlText="<a href='event:data.uname'><font color='#2112EF'><b>"+data.uname+"</b></font></a>"+tempmsg;
if(data.datetime>Application.application.lastlogout)
Alert.show(Application.application.lastlogout);
lbl.setStyle("fontWeight","bold");
private function lbl_link(evt:TextEvent):void {
]]>
</mx:Script>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
Now my text is coming properly with link like how i wanted. I have added here another functionality where I am checking the last logouttime of user and the msg time and if msgtime is greater than last logout time then i am showing it in bold.
override public function set data( value:Object ) : void {
super.data = value;
lbl.htmlText="<a href='event:data.uname'><font color='#2112EF'><b>"+data.uname+"</b></font></a>"+tempmsg;
if(data.datetime>Application.application.lastlogout)
Alert.show(Application.application.lastlogout);
lbl.setStyle("fontWeight","bold");
First time is shows properly but if i scroll then some random row is also appearing in bold, also when ever this set data function is getting called some random rows are coming in bold.
Please let me know your input
Similar Messages
-
How to access variables declared in main mxml in itemrenderer files
Hi,
I have a main mxml which has a cutomRenderer that defines two
mxml components
namely raidobutton and textinput.
Now in this TextInput.as i need to access variable defined in
main mxml.
Please suggest a way.
Thanks,
LuckyLets say you have a public property in your application like
public var name:String = "John Smith";
to access this using an inline item renderer:
<mx:itemRenderer>
<mx:Component>
<mx:VBox>
<mx:TextInput text={outerDocument.name} />
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
To access variables of the applicaton you can use
Application.application.name (for example) to reference "global"
variables, so you might also use this technique. With an inline
item renderer, the outerDocument property will refer to the
component which contains the renderer. -
How to access a variable from one mxml to another mxml?
I have Vbox having Hbox in turn hbox has some components ...TextInput...
I m adding this Vbox in another mxml file....iteratively ....
I need the sum of all the enetered values in the text boxes to be displayed on the textbox in another Mxml ...
I am taking sum in a variable and want to show tha some in another file...
How can I get that variable in my resultant mxml??
TIAIn this case it is best to use custom events to pass data. Here are some resources:
http://chikaradev.com/learning/flex3/customevents/StudentsTutoringCustomEvents1.pdf
http://chikaradev.com/learning/flex3/customevents/CustomEvents3/CustomEvents3.html
http://livedocs.adobe.com/flex/3/html/help.html?content=createevents_3.html
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex / AIR Development, Training, and Support Services -
Running a method in a class from main.mxml
So... this seems dumb, but I can't seem to run a method on an instance of a class. I should be able to
arraycollectioninstance[0].methodinclass(); //this doesn't work
I also tryed arraycollectioninstanace.getItemAt().methodinclass();
All I want to do in run the function sortByUdn() that resides in the class definition from main.mxml on an instance of an arraycolleection. How do I do this and why doesn't the above attempts work? What am I missing?
Below is my class:
package status
import mx.collections.ArrayCollection;
import mx.collections.IViewCursor;
import mx.collections.Sort;
import mx.collections.SortField;
import org.osmf.layout.AbsoluteLayoutFacet;
[Bindable]
public class Rack
public var currentSort:String = 'udn';
public var lowestUdn:int;
public var highestUdn:int;
public var circuits:int;
public var rackModel:String;
public var rackLevels:ArrayCollection = new ArrayCollection;
public function Rack(response:XMLList):void
circuits = response[0].info.length();
for (var i:int=0; i < circuits; i++)
rackLevels.addItem(new Level(
response[0].info[i].@udn,
response[0].info[i].@circuit,
response[0].info[i][email protected](),
response[0].info[i][email protected]()
findMinMax();
protected function sortByUdn():void
var udnSort:Sort = new Sort()
udnSort.fields = new Array();
udnSort.fields.push(new SortField('udn',true,false,true));
this.rackLevels.sort = udnSort;
this.rackLevels.refresh();Thanks for the response!!!
So my problem is that my class (Rack) has the functions, but I'm using an arraycollection of instances of this class. So in my main Application I have:
public var current_rack:ArrayCollection = new ArrayCollection;
then later on I'm using a current_rack.addItem(new Rack(.......) several times to make the instances.
I'm trying to call a function in one instance of current_rack[7] to perform a sort on that instance. I'm storing the sort function as part of the class, as it sorts the inards of the class instance.
I really want to current_rack[0].sortByUdn();
Though the above doesn't generate a compiler error, I get a runtime error of RangeError: 'Index '0' specified is out of bounds' -
How to Access Maintenance View from a program
Hi Experts,
I have created a maintenance view for a table. i want to insert data's into the table through the maintenance view. I don't know how to access the view, how to insert data into the Maintenance view. Please suggest me how to access the view from the program.
with regards,
James...
Valuable answers will be rewarded...Hi,
What is the need to search for a program.
Use transaction SM30 or SE16 to create or maintain entries in the table.
e.g. if the Maintenance view is created on table A, then Goto transaction SM30 or SE16 and give the table name as A and proceed. This will automatically take u to the maintenance view on tha table A.
Regards,
Himanshu -
How to access Oracle 8g from SQL Server 2005 SP3 EE 64 Bits ?
Dear All,
How to access Oralce 8g from SQL Server 2005 SP3 EE 64 Bits (liked server).
Best regards,
Miguel GavinhosHi!
For the Oracle version is 8.1.6. what should I install, to access Oracle trought a linked server.
Best regards
Miguel Gavinhos -
How to access the cloud from my pc?
how to access the cloud from my pc?
Go to Verizonwireless.com, log in to your account (or register your phone number if you haven't done so). Once logged in, Go to My Verizon, My Device, Backup my contacts. That should bring you to your Cloud "dashboard" - where you can view Contacts, Photos, Videos, Music,Documents, and anything else you've sent to Verizon Cloud.
If this doesn't work for you, then where does it break down? Do you get any error messages? -
How to access the Oracle from Unix when SID is not provided?
How to access the Oracle from Unix when SID is not provided.
User Name : xxx
Password : yyy
SID : SID
I use to access it using below command from Unix prompt:
sqlplus xxx/yyy@SIDNow since I dont have SID, how to access the Oracle DB from Unix Box?
User Name : xxx
Password : yyy
Service Name : zzz
Regards,
Sunny.Hi Ajay
Thanks for the suggesstion :)..It worked as well.
The Actual problem was in the "tnsnames.ora" file where in I need to make entry for the new SERVICE name.
Now I am able to connect it properly.
Regards,
Sunny. -
How to access Cyrillic glyphs from Trajan Pro 3 Regular?
I can download Trajan Pro3 regular in greek and latin glyphs but not in Cyrillic. Using Mac OS 10.7.5, Font Agent Pro 6.010.
No EULA Licence Agreement in russian, but Adobe told me I bought the right font (with cyrillic glyphs).Thank you a lot.
The first downloading was not correct. I loaded again, and now it is ok.
Best regards
Catherine Anderegg
Anderegg Graphic
Le 23 févr. 2015 à 21:10, MiguelSousa a écrit :
How to access Cyrillic glyphs from Trajan Pro 3 Regular?
created by MiguelSousa in Adobe Type - View the full discussion
Yes, the Trajan Pro 3 fonts have Cyrillic glyphs in them. You need to use Unicode-encoded text to get to them.
Википедия
Cyrillic script in Unicode
If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7222734#7222734 and clicking ‘Correct’ below the answer
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7222734#7222734
To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"
Start a new discussion in Adobe Type by email or at Adobe Community
For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624. -
Can anybody tell how to access web service from Message Driven bean
Can anybody tell how to access web service from Message Driven bean
Can anybody tell how to access web service from Message Driven bean
-
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?
thanksmsabljic , 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 -
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. -
How can i pass variables from component MXML to main MXML
I have been struggling to pass some variables from my custom PanelTest.mxml to Main.mxml
In my Main.mxml, i tried:
import PanelTest;
private var newVar:String;
private var _panel:PanelTest;
_panel.thisVar = newVar;
I then bind the newVar to a Label textfield and nothing happens.
ThanksOne possibility would be to use a Login PEI to set a unique UserInfo Name/Value for the user. I think in 5.0 each guest session is unique, so would have unique UserInfo. Then you could pass this value to your portlet (by specifying it in the web service) and use it as a key into a Application-scoped hashmap where you store your info. In other words, your Application variables option, but you have a way of uniquely naming your variables via PEI-set UserInfo.
-
How to access the datagrid in one mxml in another component
I have a datagrid in a.mxml. when click on the add button, it comes to a b.as file (not a class) to do some things and then, b.as call a popupwindow (c.mxml) to add a row into table (call backend). After I added the row to database table successfully, I want to add the row into datagrid to display, but I could not access the datagrid in a.mxml from c.mxml. How can I do this?
Thank you in advance.If this post answers your question or helps, please mark it as such.
To add a row to the DataGrid you really need to just add data to the dataProvider collection object.
You can access components by going through the main app:
mx.core.Application.application.myA.myVar = myC.cVar;
But you should really be using custom events to communicate between components, though it is more complex. Here is my Flex 3 Cookbook post of the topic of custom events:
http://cookbooks.adobe.com/post_Building_a_wizard_using_a_simplified_MVC_architect-11246.h tml
Here are some sample apps on custom events on my web site (right click to View Source):
http://www.chikaradev.com/learning/flex3/customevents/CustomEventSimple/CustomEventSimple. html
http://www.chikaradev.com/learning/flex3/customevents/CustomEvents1/index.html
http://www.chikaradev.com/learning/flex3/customevents/CustomEvents2/CustomEvents2.html
http://www.chikaradev.com/learning/flex3/customevents/CustomEvents3/CustomEvents3.html
Here is my tutorial on custom events:
http://www.chikaradev.com/learning/flex3/customevents/StudentsTutoringCustomEvents1.pdf -
How to access graphic components from classes?
Hi,
I am creating a Flex application. In my Main.mxml, I add
different UI elements, such as panels. I also have a few
actionscript files. Everything is in the same folder. So my
question is : how can I access a panel created in Main.mxml from an
actionscript class ? By accessing the panel, I mean things like
change its properties, etc. Is it possible to access those in a
'Flash-like' way, using something like _root.myPanel, or is it only
possible through passing parameters?Well...it pains me to see someone obviously new to programming struggle here...so I'll take this one on:
Here is the BAD way to do it...but it is basically what you are looking for...to learn GOOD ways to do this, please invest in some programming books and learn about encapsulation, MVC, and other programming/architectural styles...anyways...here is the BAD, but easy way:
In your SGui class, right after the constructor you have to "declare" your object reference as a class member, so edit your file to make it say:
public class SGui {
public JButton addStickButton;Then, edit the line in SGui that says:
final JButton addStickButton = new JButton();so that it just says:
addStickButton = new JButton();Then, in your Soft class, you can access it just the way you wanted to in your comment:
gui.addStickButton.setEnabled(false);Other Java programmers reading this thread will probably shoot me for showing you how to do it this way, because it violates principles of encapsulation...but go ahead and use it so you can move forward...but study a little more online or in books to get the hang of it :)
Message was edited by:
beauanderson
Message was edited by:
beauanderson
Maybe you are looking for
-
So I bought the new Macbook Pro Retina 15" and restored from my Macbook Pro 13". Everything is good except that when I go to AppStore to update other Apps it says I need the latest 10.8.2 update but that doesnt' even show up. Is there some new upda
-
Windows 8.1 does not recognize Nano 7
My Windows 8.1 OS does not recognize my Nano 7th Gen.
-
Why is my battery discharge completely overnight even when the device is not in use?
Why is my iPod battery draining completely overnight even when not being used and no apps are left open?
-
How many primary keys for one table?can we add more primary keys
In general Table have one primary key.is it possible to more than one primary key in a table?(ie is it possible to add more than one pirmary key in a table). Help me out.
-
I read in this forum that LR is able to read the encrypted white balance information from NEF files but there is other encrypted information that LR does not have access to. Am I giving up anything important by using LR and not having access to that