Why are my swfs not the right resolution? - apache-flex

Forgive me if this is a really stupid question, but I cant figure it out.
I must admit this is my first project in flex as opposed to flash cs3.
All of the assets that I'm using in my .swc are in a .fla that is 1024x768.
Nothing in my actionscript code is scaling down the size of my app, but every time I test my project, my project only takes up maybe 600x500 of the stage, instead of filling it up as I had imagined..
What am I doing wrong here?

In standalone player use exact width and height not percentage.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="1024" height="768">
<!-- more staff -->
</mx:Application>
And as far as I know there are no way to may it work in standalone player with percentage.

Related

Flex 4: Window's minimum size is too big

I tell the window to create with a size of 32x32
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
showStatusBar="false"
width="32"
height="32">
but it appears like this
The yellow box is an image that's 32x32.
try setting minWidth=32 minHeight=32
You have something in your window that is more than 32X32 so the window got resized to fit its content, sharing your full code will help us finding the problem.
The AIR application config xml file has a minwidth property. I assume you're on windows. In that case, the close, minimize, fullscreen buttons should always be visible, so you can't make smaller window (try resizing notepad.exe to understand). If you want smaller, you have to make a chromeless application / window (again in the config xml). That will allow you to create 1x1 px windows as well, but you'll have to add your own close button.
<systemChrome>none</systemChrome>

Adobe Flex Content Disappears in IE8

I am having an interesting bug in MSIE8, only.
I have also tested this in MSIE7, MSIE9 and Chrome and could not reproduce it in those environments.
I have a flex application which is embedded in a webpage. The application has a few top level components. One is a mx:ViewStack which contains a number of different icons. The other is a mx:Canvas which contains a number of child mx:Canvas elements (which are used as layers to hold other UIComponents).
<mx:Canvas backgroundColor="#FFFFFF" id="drawing_area" borderColor="#000000" borderStyle="solid" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="728" x="10" height="522.8889" y="10">
...
</mx:Canvas>
The error occurs when I perform the following steps.
Load the page with the component
Let the component fully load
Scroll down so that the top of the flex content goes outside the bounds of IE8's content window.
When I do the above, the mx:Canvas with the border disappears. It can still be interacted with, but any content moved into one of the child elements also disappears.
In this first image you can observe my starting state, there is a border around the drawing area, and the drawing area can be interacted with.
This second image shows the issue, after additional scrolling down. The border disappears and all UIComponents placed into the drawing_area also disappear.
Unfortunately IE8 is still a popular browser in the organization this was designed for.
Anyone have any clues as to what might be happening. I have tried different wmodes for flash. I am currently using window, but have tried transparent as well, and have the same issue.
I have tried a number of different things to get a work-around for this bug without much success.
I am using Rails on the backend and this issue is tied to only the "new" action, and does not appear on the "edit" action. Both pages use a shared partial to render the content.
Because of this I am doing browser detection using the rails gem browser. When a user is using IE8 I provide a recommendation to upgrade. On the page that has this error occurs I am providing instructions to enter data for the required fields and then save their report. This will take the user to the "edit" action and they will be able to interact with the flash content without issue.

How to reference the image used as icon for a button in Adobe Flex?

I am developing a Flex application in which I would like to simulate roughly what we get when we serach Google for images. When we pass the mouse pointer over an image, it enlarges a little bit so we can see it better and click it if we want.
I know I could just use an image and increase its size via mouseOver/ mouseOut events, but the thing is that it is much easier for users to realise that they're clickable when I use a button with an icon (as opposed to a plain image).
So here's the question. Is there any way to alter (in this case, its height and width) the button icon through the button methods/ properties?
I can explain it a little further if this is too confusing.
Thank is advance.
P.S.: The way I'm doing it now is by changing the src property of the icon to switch to another (larger) version of the same picture (that requires two versions of each pictures to be stored). However, I'm using the setStyle method to achieve that, which, according to the documentation itself, is not very good performance-wise. And it's so much easier to adjust the size than to have to load another picture which is just an old version of the previous one.
If your picture is enlarged only 'a little bit', you can get away with one (larger) version (just set smoothing = true on underlying Bitmap.) This also enables smooth transition from small to larger version. And hand cursor would be fine way to indicate clickableness, while very large buttons will look strange.
The question was already asked in these threads
Create a button with an icon in actionscript
Set the icon of a Flex button with a Sprite in runtime
According to them there is no graceful solution, but the task can be done via setStyle() or using this snippet:
http://blog.benstucki.net/?p=42
The another way is to use a hack like this (Transparent button over image):
<s:Group width="100" height="20">
<mx:Image source="picture_you_need.jpg" width="100%" height="100%" scaleContent="true" maintainAspectRatio="false"/>
<s:Button id = "test_button" width="100%" height="100%" alpha="0.0"}"/>
</s:Group>

Flare Graph Dragging Problem

I am using Flare as my graphing library of choice for my current Flex project. Everything works great - my graph is being displayed correctly, but moving it poses a problem. The graph can be moved anywhere around the application, even outside of the graph's panel/container. It can even be placed on top of buttons and other GUI elements.
I need the graph to stay within its parent container, only able to move within its parent. I've spent numerous hours trying different approaches recommended by other Flare/Flex developers and nothing seems to work.
Some approaches I've tried: setting rectangular bounds on the graph's parent container, placing the parent container or the graph itself within a sprite object and setting specific bounds, and setting the clipToContent property appropriately.
I've found a few Flare demos online and each of the graph demos that are represented by nodes and vertices seem to have this same issue. This makes me thing that it's a Flare bug, but I don't want to jump to that conclusion yet.
Any help is greatly appreciated! Thanks.
I faced the same situation, and I solved it by creating a mask for my Visualization(solved or circumvented? lol):
--> in my .mxml
<mx:Panel width="65%" height="100%" layout="absolute" id="graphPanel">
<flexvis:FlareVis id="graph" label="Graph" width="100%" height="100%" />
<mx:Canvas width="100%" height="100%" id="graphMask" />
</mx:Panel>
--> in actionScript:
var vis:Visualization = graph.visualization;
vis.mask = graphMask;
There are two different issues causing this problem.
1)hitarea for panning and zoom. ->while using PanZoomControl, define the hitarea,like new PanZoomControl(here to specify the hitarea). It will help to solve the problem "mouse interactive out of the vis area cause the vis moving around";
2)mask to control the display area. It will help define the area to display your vis, or the vis will go out of the boundary.
Hope this helps:)

How to make a window show up outside the app?

In our Flex AIR app, we have the problem that our main app window is fairly narrow. This means Alert dialog boxes are chopped on both side, while the right click menu is cropped. How can we get these windows to not get cropped by our main window?
Turn your main AIR window into an invisible transparent window and make your app's primary working window a child of the invisible one. Then when you AIR app starts, make the invisible window the size that encompasses the desktop. You'll then be able to position as many windows and dialogs as you want on this desktop area without worrying about them getting clipped as is happening to you now.
If you want to support multiple screen displays - such that your visible app window can be drug around from display to display, then make your invisible window the size of the entire graphics coordinate system such that it encompasses any and all display screens.
Once you go with the invisible window approach, you'll be able to achieve windowing behaviors that are like that of native applications.
How are you showing the Alerts? If you are using Alert.show(), it will use the default width. However, you can get around this by creating an Alert Object, setting the width manually (or even dynamically), and then using the PopUpManager to show it, place it where you want, and hide it. It takes a little more code, but gives you a lot more flexibility.
Here's a small sample:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="creationCompleteHandler();">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.PopUpManager;
private function creationCompleteHandler():void
{
var alert:Alert = new Alert();
alert.width = 100;
alert.text = "this Alert is\n100px wide";
PopUpManager.addPopUp(alert, this);
PopUpManager.centerPopUp(alert);
Alert.show("this Alert uses the default width");
}
]]>
</mx:Script>
</mx:WindowedApplication>
With flex applications running inside of the flash player, windows cannot be shown outside of the stage. So the only way to make this work would be to make your app larger.
You could though use the flex/ajax bridge and call a javascript alert box instead, they would not be bound by the stage. But it would not be skinned like the rest of the application though and would take some more work to get hooked in, especially if you are listening for the user to click the okay button...
I believe the dojo extensions for adobe air should be able to do what you are after. Never used it myself and not sure what the trade off will be but it might be worth looking at.
http://sitepen.com/labs/dair/

Resources