i'm doing the maintenance of a flex application and i have a form to create new items:
<mx:FormItem id="frmName"
width="100%"
label="{Translate.getInstance().translateWords.name}"
required.edit="true"
required.new="true"
required.view="false">
<s:Label id="name_l"
width="100%" height="23"
text="{ myProgramVO.program_name }"
maxDisplayedLines="0"
lineBreak="toFit"
includeIn="view"/>
<s:TextInput id="name_ti"
width="100%" height="23"
maxChars="100"
maxChars.edit="100"
maxChars.new="100"
text="{ myProgramVO.program_name }"
includeIn="edit,new"/>
</mx:FormItem>
I don't know why, but i cannot write characters with accents when i'm creating a new program, but i can when i'm editing a program. And does not seem an unicode problem because i can type ñ without any problem.
The mxml file has <?xml version="1.0" encoding="utf-8"?> and the file is the same for item edition.
Can somebody guide me in the right direction?
PS: If anybody needs more code just ask for it and i'll paste in pastebin or something
After some research, it seems that there's nothing wrong with my code, it seem a problem with focus when mix html and swf.
When i try to create a new program, i need to mix html and flex, but when i edit the program there's no html code, and works well.
I got the problem only in linux (flash version 11.2), in windows (version 11.8) works perfectly, so seems a problem has been fixed
Thanks anyway guys :)
Related
I have been given the unenviable task of displaying a logo on a flex 3.2 form on our website. I'm learning flex as I go, and I can embed a logo now.
The problem is, I need to display a different logo, depending on which client the user works for. And I need to have it working by end of day, Friday, August 30th. As in, this Friday.
This is the code I have for embedding the logo:
<mx:GridRow width="100%" height="100%">
<mx:GridItem width="100%" height="100%" colSpan="6">
<mx:Image width="180" source="#Embed('/assets/images/logo.JPG')"/>
</mx:GridItem>
</mx:GridRow>
So, what I need to know is, is there any way to get Flex 3.2 to display a different logo for each client? The above code obviously isn't going to do it.
As a further bit of info, we do have the logos as blobs in the Oracle database.
Thanks for any help.
You need not embed, you can give path to the images on the server. like
<mx:Image width="180" source="http://somedomain.com/images/logo.JPG"
id='image'/>
OR, using the id of the image component, you can assign the logo dynamically, like the following
private function onCreationcomplete(e:FlexEvent):void
{
if(client ='xxyy'){
image.source = 'http://somedomain.com/images/xxyy.JPG ';
}
}
If you are familiar with BlazeDS, then you could try this approach: BLOB from Java to Flex via BlazeDS.
For the approach from #Zeus I would recommend to write an image servlet which delivers the client logo at request from your database blob.
I'm facing an issue with the flex Application I'm currently working on.
When I open a pop-up using the 'createPopUp' method, I've got this index out of bounds error message :
RangeError: The supplied index is out of bounds. at
mx.core::FTETextField/getLineMetrics()[E:\dev\4.y\frameworks\projects\spark\src\mx\core\FTETextField.as:2169]
at mx.core::UIFTETextField/get
baselinePosition()[E:\dev\4.y\frameworks\projects\spark\src\mx\core\UIFTETextField.as:784]
at mx.controls::DateChooser/get
baselinePosition()[E:\dev\4.y\frameworks\projects\mx\src\mx\controls\DateChooser.as:994]
at spark.components::Group/get
baselinePosition()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:282]
at
spark.layouts::ConstraintLayout/parseElementConstraints()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:1818]
at
spark.layouts::ConstraintLayout/parseConstraints()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:1632]
at
spark.layouts::ConstraintLayout/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:414]
at
spark.components.supportClasses::GroupBase/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\GroupBase.as:1148]
at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
at
mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430]
at
spark.components::Group/validateSize()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1012]
at
mx.managers::LayoutManager/validateClient()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:987]
at
mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:382]
at
mx.managers::PopUpManagerImpl/createPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:232]
at
mx.managers::PopUpManager$/createPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManager.as:139] at
views::AddProjects/loadAddProjectPopUp()[C:\Users\Laura\Web\spidermak\spidermak\src\views\AddProjects.mxml:184]
at
views::AddProjects/___AddProjects_Button1_click()[C:\Users\Laura\Web\spidermak\spidermak\src\views\AddProjects.mxml:838]
It seems that this error is caused by a "dateChooser" component in my popup :
<mx:DateChooser id="endDate"/>
When I comment this line, the error is no longer thrown and the popup loads correctly.
It's really weird because I didn't have this issue until this morning. All I did in the meantime was changing some layout-related stuff, but I don't see what is would have to do with this problem.
I don't get it...
Does anyone have a clue about how to fix this ? I need my DateChooser !
Thanks !
Laura
EDIT -
It seems that the problem is not caused by the DateChooser itself, but by the FormItem around it. Here's what my code looks like :
<Form width="100%">
[...]
<s:HGroup width="100%">
<s:FormItem label="Date de début">
<mx:DateChooser id="startDate"
firstDayOfWeek="1"/>
</s:FormItem>
<s:FormItem label="Date de fin">
<mx:DateChooser id="endDate"
firstDayOfWeek="1"/>
</s:FormItem>
</s:HGroup>
</Form>
If I remove the two FormItems, it works. Could anyone explain me why? Thanks !
Try wrapping the component in a <s:Group> element, i.e.
<s:FormItem label="Start date">
<s:Group>
<mx:DateChooser id="startDate"
firstDayOfWeek="1" />
</s:Group>
</s:FormItem>
Apparently, it's something to do with the composition of Spark components. lolFlex.
(I had exactly the same problem, and couldn't find any solution on the interwebs either!)
I think you should upgrade to the latest TLF. This reminds me of a bug in TLF 1.x. Try 2.x.
I thought this was the default behaviour (all the Adobe docs seem to indicate that this is the case).
Say you have a form:
Name: [______]
Password: [________]
generally you want Name and Password to line up on their right-hand side (right justification). The length should be the length of the longest label.
When I add the following code to my MXML (authoring in Flex 4) it does not do that at all! But rather tjust crams everything left-justified, similar to the Name/Password example above.
What's the solution?
<s:Form id="directoryForm_A" width="100%">
<s:layout>
<s:VerticalLayout horizontalAlign="justify"/>
</s:layout>
<s:FormItem label="Click">
<s:Button label="Button"/>
</s:FormItem>
<s:FormItem label="Root Directory">
<s:TextInput x="0" width="100%" enter="handleUserSetRootDirectory(event)"/>
</s:FormItem>
</s:Form>
Which Adobe docs were you reading? You realize that the Spark Form are going to be very different than the Halo / MX Form. I would also suspect that the Spark form is not working yet.
Here are the docs on the Spark Form.
I think you'll benefit from reading the layout rules section of the FormItemLayout details. I cannot find the documentation that claims that all labels will be right aligned.
For anyone looking to a beta solution, Peter deHaan posts about this exact topic here: http://blog.flexexamples.com/2010/08/28/setting-the-text-alignment-on-a-spark-formitem-label-in-flex-hero/
Do note, since his example doesn't translate directly over to my issue:
adding to the for some reason disables the ability for the renderer to calculate the maxLabelWidth
Hope this helps others in the future.
I'm trying to build a simple FLEX application. Unfortunately, I get '1131: Classes must not be nested.' errors even with the simples MXML .... the error pops out at the mx:Application openning tag:
(I'm using PureMVC if it's important)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:view="icm.view.components.*"
viewSourceURL="srcview/index.html"
name="ICM"
layout="absolute"
> //FLEX BUILDER SAYS THE ERROR IS HERE
<mx:Script>
<![CDATA[
import mx.effects.easing.Exponential;
import icm.ApplicationFacade;
public static const NAME:String = "AppSkeleton";
private var facade:ApplicationFacade = ApplicationFacade.getInstance(NAME);
]]>
</mx:Script>
<mx:Move id="slideInEffect" yFrom="5000" easingFunction="{Exponential.easeOut}" duration="1300"/>
<mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
<mx:Fade id="fadeIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>
<mx:Style source="css/yflexskin.css" />
<mx:Canvas id="mainViewStack" left="0" top="0" right="0" bottom="0" >
<mx:ViewStack id="vwStack" left="0" top="0" right="0" bottom="0" resizeToContent="false" creationPolicy="auto">
<mx:VBox />
<view:SplashScreen id="splashScreen" showEffect="{slideInEffect}" hideEffect="{fadeOut}" />
<view:LoginScreen id="loginScreen" showEffect="{fadeIn}" />
<view:MainScreen id="mainScreen" showEffect="{fadeIn}" />
</mx:ViewStack>
</mx:Canvas>
</mx:Application>
Can someone help me understand why? I've being doing a lot of non-sense tests because I'm not understanding it.
Sometimes if I remove the Script section the compilation suceed, others not.
Thanks
Thank you all for the comments.
The greatest tip at this topic is: build with the SDK!!!
Flex Builder (both, the IDE and the Plugin) seems to lack a lot of features on error treatment and even when it reports an error it's not reliable.
A prompt window for compiling used with the IDE saved me a lot of headaches.
Thank you all again!
I had this problem using a compiler option to exclude/include some code
like -define+=CONFIG::myOption,true
when the option is true (resulting including some code), and you have such thing into your code :
CONFIG::myOption {
import <a package>;
}
this will result in a 1131 error... I have no workaround but not using such conditional compilation directives.
There is a flex compiler option "Enable Strict type checking" just de-select it. I think that can give so a simple solution....
http://blog.gigantt.com/2011/02/how-to-build-flex-sdk.html
Building
Let's create a batch file to set some useful envars: envars.bat
set JAVA_HOME=c:\Program Files\Java\jdk1.6.0_23
set PATH=c:\dev\ant\bin;%PATH%
set ANT_OPTS=-Xmx256m
Open cmd.exe and run it...
Edit c:\dev\sdk\frameworks\build.xml
Look for:
And fix the location of the manifest file from:
"${datavis.dir}/manifest.xml" to:
"${datavis.dir}/manifest_datavisualization.xml"
Run Ant:c:\dev\sdk\frameworks> ant
It should end with such a message: BUILD SUCCESSFUL
Now let's tell Flash Builder where to find this new SDK: c:\dev\sdk
Add it to the "Installed SDKs" settings in Flash Builder
Make sure your project is configured to use this SDK (it was probably created with the original one and still refers to it).
Rebuild your project. It should work.
I just started using flashdevelop for flex apps (I had been using it for pure as3 projects previously). I can't figure out how to import files and such. I have included them to the library as usually. In this case I have included flexlib.swc and flexmdi.swc. Both are in my lib folder and both have been right clicked and Added to the Library.
Auto complete does not work so I think I am missing a step.
This is my code:
`
<flexmdi:MDICanvas id="mdic" width="500" height="500">
<flexmdi:MDIWindow id="win1" title="Window One" x="10" y="10">
<samples:SampleContent />
</flexmdi:MDIWindow>
<flexmdi:MDIWindow id="win2" title="Window Two" x="250" y="250">
<samples:SampleContent />
</flexmdi:MDIWindow>
<flexmdi:MDIWindow id="win3" title="Window Three" x="100" y="100">
<samples:SampleContent />
</flexmdi:MDIWindow>
</flexmdi:MDICanvas>
`
I also tried to add
<mx:Script>
<![CDATA[
import flexmdi.containers.MDICanvas;
import flexmdi.containers.MDIWindow;
]]>
</mx:Script>
I also get a strange error saying flexmdi:MDICanvas is not bound.
I might be way off here because we're talking about FlashDevelop, but I'm pretty sure you need to add the namespace for the MDICanvas in your MXML root tag, like this:
<?xml version="1.0" encoding="utf-8"?>
<MDICanvas xmlns="flexlib.mdi.containers.*" xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
...
</MDICanvas>
The import statements only apply to .as files or <mx:Script> sections of your MXML code.
Death by repetition, but Flex has two ways to import classes and packages. The MXML way and the AS3 way.
Unfortunately, the latest stable releases of FlashDevelop does not support code completion in MXML, although the feature is fully implemented in AS (you can browse packages in libraries with code completion in actionscript).
If you need help with MXML, I suggest keeping the library's API open side-by-side with FlashDevelop (it's what I prefer to do anyway). Still, you need to make sure that you include all of the XML namespaces. For example, for the Degrafa graphics library, you need to include
xmlns:gfx="http://www.degrafa.com/2007"
in the tag (there is also a similar namespace definition for the namespace "mx" already there).
However, MXML code completion is hopefully going to be implemented in a stable release very soon, and there have already been some ways to get it working.