TabIndex in many Components?
I have a JFrame with many components (TextFields, JCheckBox, radioButtons, etc), and its are in many Panels with diferents Layouts.
How can I change the tabindex (the orden in wich the components are getting the focus when I Press de key Tab)?.
Thanks
http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#customFocusTraversal
Similar Messages
-
Hi, this is just a simple theory question. Is there one out there could tell me the answer. How many components are there in Java ?
Thanks,
choongteckgrins
As many as are derived from the Component-Class plus 1 (for the Component-Class itself)?
Would you like to know the total number of classes or the number of instances of the classes? :)
greetings Marsian -
JDeveloperStudio 10.3 -- ADF Faces -- Too many components causes crash
My page has finally gotten so complex that the stack overflows and the application just aborts. I can remove a couple of components and the page works fine. It doesn't seem to matter which components I remove; when I navigate to the page the following appears in my Embedded OC4J Server log.
Debugger connection to debuggee process has been lost.
Process exited.
Debugger disconnected from local process.
The MyPagejspx.java file is over 500K and the class file is about 110K. If I remove some components and get the total MyPagejspx.java file under 500K then the page works again.
The page includes a lot of MapViewer navigation controls and a number of tables that are used to display and edit attribute data. Most of these tables include nested tables inside of their detailStamps. Rows in a table of streets have tables of sites. This is where things start to fail.
Sometimes (but not always) I get a message that tells me that could not find the StackOverflowError class so I have tried adding a -Xss1024k option to my Java options but this didn't help; neither did -Xss2048k.
I am highly confident that the problem is not caused by the code itself as I can remove any panelGroup or panelForm set on the page and it works. I put any back and it fails. It is just too many components. Everything compiles fine but JDeveloper just disconnects from the application when the page is opened.
So ... any ideas of what I might do to continue developing this page or do I have to break my application into more pages (not what the users want).
Thanks, MarkThis was easy enough to do without bothering with any database or tables. I created a bottom level include jspx as follows:
Include-0.jspf
<af:panelBox text="Bottom include file has 3 panelForms" >
<af:panelHorizontal>
<af:panelForm rows="1" maxColumns="1">
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
</af:panelForm>
<af:panelForm rows="1" maxColumns="1">
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
</af:panelForm>
<af:panelForm rows="1" maxColumns="1">
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
<af:inputText label="Lorem ipsum" rows="3" wrap="true" readOnly="true"
value="Proin orci. Suspendisse cursus lobortis magna. Vivamus id tortor. Phasellus consectetuer, quam sit amet laoreet ultrices, tortor leo aliquet turpis, ut elementum nisi eros et nisl."
/>
</af:panelForm>
</af:panelHorizontal>
</af:panelBox>I included this in another jspf file
Include-1.jspf
<af:panelBox text="Include-1.jspf includes Include-0.jspf 5 times.">
<jsp:directive.include file="/Include-0.jspf" />
<jsp:directive.include file="/Include-0.jspf" />
<jsp:directive.include file="/Include-0.jspf" />
<jsp:directive.include file="/Include-0.jspf" />
<jsp:directive.include file="/Include-0.jspf" />
</af:panelBox>I include that in another jspf
Include-2.jspf
<af:panelBox text="Include-2.jspf includes Include-1.jspf 5 times.">
<jsp:directive.include file="/Include-1.jspf" />
<jsp:directive.include file="/Include-1.jspf" />
<jsp:directive.include file="/Include-1.jspf" />
<jsp:directive.include file="/Include-1.jspf" />
<jsp:directive.include file="/Include-1.jspf" />
</af:panelBox>And that was references by my jspx page.
TooManyComponents.jspx
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces" xmlns:afh="http://xmlns.oracle.com/adf/faces/html">
<jsp:text>
<![CDATA[ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> ]]>
</jsp:text>
<jsp:directive.page contentType="text/html;charset=windows-1252"/>
<f:view>
<afh:script source="/jscript/view_tools.js"/>
<af:document rendered="false">
<af:form id="notloggedin">
<af:panelPage title="This never happens but it mirrors my problem layour">
<jsp:directive.include file="header.jspf"/>
<af:commandMenuItem text="You are not logged in. Please click this message to be re-directed to the Login Page" action="login"/>
</af:panelPage>
</af:form>
</af:document>
<af:document rendered="true">
<af:form id="loggedin">
<af:panelPage title="Too much of a good thing?">
<jsp:directive.include file="/header.jspf"/>
<jsp:directive.include file="/Include-2.jspf" />
</af:panelPage>
</af:form>
</af:document>
</f:view>
</jsp:root>This particular setup yeilded me the following error
Fatal error: Cannot find class java/lang/StackOverflowError
Process exited.
Debugger disconnected from local process.If I put a second <jsp:directive.include file="/Include-2.jspf" /> in my jspx file I get the following compile time error.
Error: code segment of method _jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) too largeIf I remove one of the jsp:include directives from my Include-1.jspf so that it reads as follows:
<af:panelBox text="Include-1.jspf includes Include-0.jspf 4 times.">
<jsp:directive.include file="/Include-0.jspf" />
<jsp:directive.include file="/Include-0.jspf" />
<jsp:directive.include file="/Include-0.jspf" />
<jsp:directive.include file="/Include-0.jspf" />
</af:panelBox>The application works.
I took all the JDeveloperStudio defaults for creating my project. I can send you a War file if you let me know where to send it.
Thanks, Mark -
Standard component's overview page have many components how they handling
Hi All,
As we seen Standard component's overview page have many components as assignment blocks,
how the over view page handling all this, and how these components are interacting with each?
waht is functionality behid it & how they handling this programatically?
Regards,
VJMHYDHi VJMHYD
Take BP_HEAD as an example and its overview page view.
BP head overview page will display view with in the same component and views from other component (say BP_ROLE).
1) for the BP_ROLE first interface component has to be defined
2) the interface component defined for BP_ROLE will be used as Component usage in BP_HEAD component (pls check the runtime repository)
3) Create a view of type overview page and assign views to overview page.
4) this overview page will be assigned to window.
Components will interact through component interface and component usage
For more infomation pls check the runtime repository or (generated repository.xml file , don't make any changes to reposito
Thanks & Regards
Raj -
Hi guys,
In HTML I can define the tabIndex on components for define the navigation order on components.
In ADF Faces this is possible? If yes how I can to do this?
Regards,
RenanHi,
well there is an option to use JavaScript. You can add a clientListener component to the fields and the assign the tab index as a clientAttribute to each of them. Then you start listening for the TAB key in your clientListeners, read the current tabIndex and calculate the next index. You then parse the components for this nxt tab index. Its a bit of JavaScript but doable. I explained the solution in the ADF Developer Guide book that I co-authored (sorry for not having a free public version of the code)
Frank -
Hi everybody, I am building a GUI using swing, everything is ok, but some times the OutOfMemoryError() occurs. I have 256 Mb in my PC, but in my application I use a lot of components too.
Does any body know how can I manage the memory and free the space that is not in use????
Thanks in advance.Hi!
I've the same problem with some of my applications. What I do is to set the max heap for the java virtual machine. I work with jdk 1.1.8, and the line command parameters are:
java -ms14m -mx60m my_application
where -ms is the initial memory heap and -mx is the maximum memory heap. You can increase them if you continue having memory problems.
About freeing the memory, try searching in the forum for "garbage collection". There are some recomendations to do that.
Hope it helps!
Regards -
So many Components (confused)
Hello, i currently try to understand how flex works and how
the whole components work togehter.
But Flex seems to have a lot of components and one component
includes other components, so it's hard to understand how they work
together and to find out what functions the different components
have.
So, perhaps someone can give me a short introduction and a
hierarchy of the several components.
PS: I've already looked into some pdf-documents but i
couldn't find a complete summary of the whole components.
kind regards
DanielWell I dont know much but since noone has answered yet ill
give what little i understand:
Flash 9 = what flex requires to be displayed on a users
system, if they dont have it then there are small applications you
can include in your application folder that will install it for
them(if everything gos right)
Flex 2 = i guess this i what youd call the framework, for all
i know theres tiny people in there performing voodoo to make stuff
happen, however your users only need to be able to install flash 9
to use flex functionality
Flex Webservices = Ive never used this but from what i
understand its basically a pre built xml renderer with some built
in extras, no can just use your own data driven system to render
the xml though
FlexBuilder = WYSIWYG application for building flex sites, i
had the beta and it actually worked alot better then what im
normally used to as far as WYSIWYG is concerned and i plan on
buying it the second im not spendin $15 a day on freakin gas.
FlexSDK = just lets you compile the .mxml plain text files
into the flex appliction, you need your own text editor to build
the apps and then use the sdk to compile them, i was really lost
when i first downloaded it but after using the beta for a few weeks
it makes sense now. You dont need Flexbuilder to use the sdk
I hope that helps, If it seems a bit simplistic, well I
really dont know a whole lot about this stuff yet. -
Hello folks,
I am looking for best practices advice when (1) creating
custom components and (2) styling and skinning.
I already know how to skin a component part of the Flex
framework. I can make a class extending ProgrammaticSkin and have
my component skinned using CSS to link the component with the
reference to my custom class.
However what about those cases when you are completely
creating a component from scratch?
Imagine a "Freehand Drawing Canvas" component that allows the
user to draw on it and has some buttons to set color styles, line
styles, etc., or imagine a "Screen Flow Gallery" component that
displays visual objects in a fashion similar to Cover Flow in the
Mac.
In many components I am aware you may reuse other components
part of the Flex framework but I am trying to picture an scenario
where you would need to draw everything yourself because there just
isn't something to base it upon so you will end up drawing it from
scratch.
To learn how instead of building one of those components I
mentioned previously I decided to start with something simple that
would illustrate this like a LiteButton component that will behave
just like the Flex mx.controls.Button but will extend UIComponent
and be completely custom drawn.
The component will have a default look and will also be
style-able and skin-able. I will provide styles for users of the
component to modify and regarding skinning anyone can create a
custom ProgrammaticSkin adding its own drawing logic and link it to
the component via CSS with the ClassReference applied to the skin
selector.
So far so good and it's clear what I want to achieve. I
actually know how to do most of the stuff here but I have one
single problem.
Here is my question, where should I put my custom drawing
logic? If I do it in the updateDisplayList inside the class
extending UIComponent it works, however I thought that it would be
a better practice to do it using programmatic skins, that way I
could provide different skin themes for my component set.
The problem is that I can't make the programmatic work in
this scenario. I tried instantiating the custom programmatic skin
during the updateDisplayList of the LiteButton component and adding
it to my display object via addChild but that didn't do anything. I
also tried creating a "default.css" stylesheet and tried to use
ClassReference as I would normally do to skin an already existing
component (or composite component as well) but that didn't do
anything either.
So how do I apply programmatic skins for completely custom
drawn components of my Flex library project?
I could do it inside the updateDisplayList of the LiteButton
class extending UIComponent but again I would like to provide
different theme sets for my components so it makes sense using
programmatic skins."jbucaran" <[email protected]> wrote in
message
news:[email protected]...
> Hello folks,
>
> I am looking for best practices advice when (1) creating
custom components
> and
> (2) styling and skinning.
>
> I already know how to skin a component part of the Flex
framework. I can
> make
> a class extending ProgrammaticSkin and have my component
skinned using CSS
> to
> link the component with the reference to my custom
class.
>
> However what about those cases when you are completely
creating a
> component
> from scratch?
>
> Imagine a "Freehand Drawing Canvas" component that
allows the user to draw
> on
> it and has some buttons to set color styles, line
styles, etc., or imagine
> a
> "Screen Flow Gallery" component that displays visual
objects in a fashion
> similar to Cover Flow in the Mac.
>
> In many components I am aware you may reuse other
components part of the
> Flex
> framework but I am trying to picture an scenario where
you would need to
> draw
> everything yourself because there just isn't something
to base it upon so
> you
> will end up drawing it from scratch.
This may help with that
http://livedocs.adobe.com/flex/3/html/help.html?content=skinstyle_3.html
> To learn how instead of building one of those components
I mentioned
> previously I decided to start with something simple that
would illustrate
> this
> like a LiteButton component that will behave just like
the Flex
> mx.controls.Button but will extend UIComponent and be
completely custom
> drawn.
>
> The component will have a default look and will also be
style-able and
> skin-able. I will provide styles for users of the
component to modify and
> regarding skinning anyone can create a custom
ProgrammaticSkin adding its
> own
> drawing logic and link it to the component via CSS with
the ClassReference
> applied to the skin selector.
>
> So far so good and it's clear what I want to achieve.
Actually after
> playing
> with the weekend and today I know how to do most of the
stuff but I have
> one
> single problem. So here is my question, where should I
provide my custom
> drawing logic? If I do it in the updateDisplayList
inside the class
> extending
> UIComponent it works, however I thought that it would be
a better practice
> to
> do it using programmatic skins, that way I could provide
different skin
> themes
> for my component set.
These aren't mutually exclusive. When you provide a skin with
a
TypeSelector, you have to add it to the display list
somewhere, and this is
typically done in updateDisplayList or addChildren. I prefer
to do it in
updateDisplayList, because you can then change it if the
style changes.
> The problem is that I can't make the programmatic work
in this scenario. I
> tried instantiating the custom programmatic skin during
the
> updateDisplayList
> of the LiteButton component and adding it to my display
object via
> addChild but
> that didn't do anything.
Exactly what did you do?
> I also tried creating a "default.css" stylesheet and
> tried to use ClassReference as I would normally do to
skin an already
> existing
> component (or composite component as well) but that
didn't do anything
> either.
I've never had any problem using an approach similar to
this...but I will
say that I couldn't see any advantage in creating a
default.css style sheet,
since it's not really default in the way that the one that
comes with Flex
is. It's much more obvious to anyone using your component
what's going on
there if you create a style sheet where they're likely to
spot it.
> So how do I apply programmatic skins with the default
look for custom
> drawn
> components?
It seems like your approach is fine, but maybe you've made a
mistake in your
implementation.
> I could do it inside the updateDisplayList of the
LiteButton class
> extending
> UIComponent but again I would like to provide different
theme sets for my
> components so it makes sense using programmatic skins.
You might want to consider also adding an instance of
HaloBorder to your
component. That brings a lot of functionality with it.
HTH;
Amy -
List of Components used in Production Order
Hi ,
I want to report in which I want to pull out all the componets in the production order.I dont want explode the BOM for the day as many components might have been manually added in the productio order and it may not be present in BOM. is there any table or Function module which I can use for the same.
Thanks ,
Tausif.You will get the data in COOIS sap std report
in which you choose
List = component list
Or list = object list and in the object list tab page choose component check box.
execute the report with order numner..
you will get all the components. -
URGENT!! How to avoid paint all the components?
In the following code sample, when you move the mouse, the top-level JPanel (with the name p) repaints itself with a red circle. The strange thing is that also the 4 JButtons repaint themselves!! (this is shown by the System.out). If the container of the 4 JButtons and the "p" had too many components, then the repaint of "p" gets very slow!! If i delete the line "super.paintComponent(g)" in the class "Myb", then the JButtons do not show correctly.
How can i avoid that the 4 JButtons do not repaint themselves all the time?
import javax.swing.*;
import java.awt.*;
public class Fr extends javax.swing.JFrame {
private javax.swing.JPanel p;
private Ap ap1;
private Myb b4;
private Myb b3;
private Myb b2;
private Myb b1;
public Fr() {
p = new javax.swing.JPanel();
ap1 = new Ap();
b1 = new Myb();
b2 = new Myb();
b3 = new Myb();
b4 = new Myb();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
System.exit(0);
p.setLayout(null);
p.setBackground(new java.awt.Color(153, 153, 0));
p.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseMoved(java.awt.event.MouseEvent evt) {
ap1.repaintWith(SwingUtilities.convertPoint(p,evt.getPoint(),ap1));
ap1.setFont(new java.awt.Font("Dialog", 0, 11));
ap1.setOpaque(false);
p.add(ap1);
ap1.setBounds(-10, -40, 500, 500);
b1.setText("b1");
p.add(b1);
b1.setBounds(0, 0, 150, 150);
b2.setText("b2");
p.add(b2);
b2.setBounds(0, 150, 150, 150);
b3.setText("b3");
p.add(b3);
b3.setBounds(150, 0, 150, 150);
b4.setText("b4");
p.add(b4);
b4.setBounds(150, 150, 150, 150);
getContentPane().add(p, java.awt.BorderLayout.CENTER);
pack();
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setSize(new java.awt.Dimension(500, 500));
setLocation((screenSize.width-500)/2,(screenSize.height-500)/2);
public static void main(String args[]) {
new Fr().show();
class Ap extends JPanel
private Point p;
public Ap(){
super();
p = new Point(10,10);
public void repaintWith(Point p){
this.p = p;
repaint();
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.red);
g.fillOval(p.x-5,p.y-5,10,10);
class Myb extends JButton
int x = 0;
public Myb() {
super();
public void paintComponent(Graphics g) {
super.paintComponent(g);
System.out.println(getText()+"-->"+(x++));
}I did that, but still nothing!
I inserted these lines!
JPanel subp = new javax.swing.JPanel();
subp.setBorder(new javax.swing.border.LineBorder(Color.blue, 2));
subp.setOpaque(false);
p.add(subp);
subp.setBounds(200, 0, 200, 200);
ap1.setOpaque(false);
subp.add(ap1);
ap1.setBounds(200, 0, 200, 200); -
Does Flash CS5 (AS3) come with more components than CS4 (AS3)?
Hi all.
Bit of a background to my question- I started learning AS3 around June last year (with no prior Flash experience). I was mainly interested in learning Flash for my own knowledge and personal projects I had in mind. Lately though I've been considering getting employed as a Flash developer, but most companies seem to be asking for AS2 experience, as well as AS3. So I fired up CS4 this morning and took a look at AS2. Probably the most surprising thing I found was that CS4 has a whole bunch more components for AS2 than it does for AS3, making me want to drop AS3 and work with AS2 permanently lol (the built in components make my life so much easier, and offer me more than faster execution does). I'm assuming the reason for this is because AS2 has been around for while, and Adobe has had more time to build more components for it, whereas AS3 is only relatively new.
So to conclude, does CS5 have more AS3 components (perhaps equal to AS2), or do we only have the same components as we had in CS4?
<3 components lol.
Thanks guys.Flash CS5:
ActionScript 3 - 3 categories (Flex, User Interface, Video). 33 components in total.
ActionScript 2 - 3 categories (Media, User Interface, Video). 36 components in total.
Flash CS4:
ActionScript 3 - 2 categories (User Interface, Video) 31 components in total.
ActionScript 2 - 4 categories (Data, Media, User Interface, Video) 25+ components in total.
Sorry that I don't know how exactly how many components are in Flash CS4 AS2. Couldn't find enough images (I don't have CS4, I use CS5).
Anyway, I think that Flash CS4 AS2 has the most components, with the most categories. However, whether you should use CS5 or CS4 and AS3 or AS2/AS1 really depends on, not how many components are available, but what you need. Chances are some components you will never touch. Also, sometimes you will need a new feature only in Flash CS5, or be asked by your future employer to write an application in the other scripting language.
So really, it depends what you think. If I were you, I would download a trial of both CS4 and CS5, and play around, see which option you like the most. Oh, and be prepared to be forced to use another option by your employer at some stage.
Hope it helps
dikuno <>< -
Sales Report in XL Reporter within Bill Of Materials Components
Hello @ all,
I've tried to create a XL Report, to know which and how many components of the BOMs are sold.
It should look like this example:
article no.12345 (BOM) sold 10x
- component No. 1----
10x
- component No. 2----
20x
- component No. 3----
30x
The BOM 12345 consits of 1x component No. 1, 2x component No. 2, 3x component No. 3
Please can anybody give me a hint???
Thanks in advance!
Thorsten
Edited by: Philip Eller on May 16, 2008 8:56 AM
Edited by: Philip Eller on May 30, 2008 8:46 AM*Hello,
I think it is not possible to get only BoM items that have sold.
BoM information can only be found in Production module in XL Reporter but to get sales information, this should be done in Sales module.
I think there are no link between them.
Just for your information, to get the BoM list in XLR,
go to Production module>
choose Product Tree dimension> items dimension(this will choose items that have BoM defined) > Quantity measure(this will list quantities assigned in BoM for each child items.)
In Sales module, you can choose all items where to show the sales information.
Regards,
Maggie An
SAP Business One Forum Team -
Hello all,
I'm trying to build a RFC - XI - Web Service Scenario. But to start I need to import my RFC that will comunicate with XI. How do I do it? The RFC is hosted in an ECC 6.0 but there are too many components in the sofware catalog that I dont know what to import. Or what to choose
How do I do it?
Thanks for your help.
FelipeAamir,
Thanks for your quick response, but the problem is that I have not imported the component version, because the Sofware Catalog has sooo many components that I dont know what to import. How can I know what to import?
I already have the SAP ABA 7.00 and SAP BASIS components in the IR, but these where set up during instalation.
How do I know what component of all ECC components is the one that I have to import?
Thanks,
Felipe -
Embedding same images across multiple components, best practices?
Hi Guys,
Once again a great forum.
I have a fairly large dashboard application, built from many
components, from an obvious maintenance point of view this is
preferred.
To keep the look and feel the same across each component I
reuse a lot of the icons, this icons have 3 states, disabled,
normal and hot(rollover)
The mouse roll over and roll out are the same for each set of
icons. At the moment I have each component embed each icon and
repeat the functions.
This is not the optimum way to do this so I'm looking on best
practices. Should I build a separate action script package with all
the embedded images and roll over/out functions. Then import that
in to each component. But then I will embedded ALL the images in
each component. Should I embed all the images in the main container
app, then when flex sees the same image in a compoent will it not
embedded again or will it embed the images again..
In the example below 4 of the components have the same
refresh icon and roll/over states. So this code is repeated (bad
practice) in all 4. Moving to separate action-script package will
make maintenance easier, but as stated above will just one copy get
embedded for the entire app, or will 4 copies get embedded ?
[Embed(source="images/refresh_24.png")]
[Bindable]
private var refreshIcon:Class;
[Embed(source="images/refresh_24_hot.png")]
[Bindable]
private var refreshIconHot:Class;
[Embed(source="images/refresh_24_dis.png")]
[Bindable]
private var refreshIconDis:Class;
private function rollOverRefresh(event:Event):void {
if (event.target.source != refreshIconDis )
{event.target.source = refreshIconHot;}
private function rollOutRefresh(event:Event):void {
If (event.target.source != refreshIconDis )
{event.target.source = refreshIcon;}
}Flex is able to collate those Embeds so they are only
included once IIRC.
While it may seem like bad practice to include it in each
component, it really isn't, from a code reusability standpoint. But
you could probably continue on that path and create a custom
component <mycontrols:RefreshButton> that has the the embeds
in one place for you.
You could probably also do something similar with style very
easily:
.MyButton {
overSkin="@Embed(source='../assets/orb_over_skin.gif')"
upSkin="@Embed(source='../assets/orb_up_skin.gif')"
downSkin="@Embed(source='../assets/orb_down_skin.gif')"/>
Then apply that style to your button.
You could also put the button into a single SWF file in Flash
and include it that way to reduce the number of embeds. I never
include PNG, JPG, GIF, etc files directly, always SWF as you get
better compression that way IMO. Plus I just find it gives me
greater flexibility...if I want to animate my skins in the future
(button that gleams for instance), I already have SWF's in my code
so no need to change anything out but the SWF. -
How to access (call) variables from multiple components
I have what I think is a basic task, but I cant seem to get it to work. I have a Flex project with one application. In addition to the one application, I have many components that are used in the application. These components vary from simple (a ComboBox) to complex (many sub-components). What I need to do is define a viable in one component and access it in another component. I can't seem to do this. Below is an example of how I think it should be:
Component1
<mx:Script>
<![CDATA[
[Bindable]
private var userID:int=0;
]]>
</mx:Script>
Component2
<mx:TextInput text="{Component1.userID}"/>
Any help you can provide would be beneficial.
LeeHello,
You may also want to consider using the mx.core method.
In your main application script area define all of your public variables and functions. Then from your component, you can reference these absolutely with the following syntax.
<!-- Main App -->
[Bindable]
public var userID:int;
<!-- Component -->
private function init():void {
var com_UserID = mx.core.Application.application.userID;
Using this method ensures that you will have access to any Function or variable within the scope of the project.
Kind Regards,
Dr. Ivan Alexander, Ph.D.
Sr. Applications Engineer
FlexAppsStore.com
Sun Microsystems
MySQL Enterprise Ready Partner 2009
Maybe you are looking for
-
Hi all experts, I want to know if found fragmentation in undo tablespace. Is it recommaned to treat it the same way as usual permanent non system fragmented TBSs. i.e. do fragmentation I wonder if temp/undo tbs needs to be defragmented. Looking for y
-
Slideshows in Firefox/IExplorer
I've been reading up on this and it seems like there are numerous issues regarding this: slideshows, navigation, etc are not working AT ALL in FireFox or Internet Explorer. Sometimes it partially works, sometimes the fonts are bad. What's the deal? I
-
DR Server not started generating errors
Dear All i want to start dr server but it generating error SQL*Plus: Release 10.2.0.2.0 - Production on Wed Oct 22 09:58:18 2008 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. Connected to an idle instance. SQL> startup ORACLE instance start
-
Unable to enable GPU rendering in Project Settings (CC 2014)
I have two GTX 580s installed and the option for GPU rendering is grayed out in the project settings dialog box. Any ideas on why that is and how to fix it?
-
Hello, I want to calculate cost for all nodes of level 3 and below of WBS hierarchy before reporting. I would like to know if there is a functional module in BW which allow to work with hierarchy : 1. transform hierarchy into view WBS element , level