I have an AIR app with a "settings" area. It is loaded in a scrollpane.
Initially all the settings were in a movieclip scrolled by the pane. But now the settings are too many and I decided to place some buttons to go in the appropriate area.
I can't load the whole content of the scrollpane pressing the button as I want to allow the user to change various settings, in various areas and press "save" just at the end (swapping the pane content I lose the unsaved settings). So I decided to place various MC inside the content and turn them on and off with "visible" property.
The problem is that the scrollpane keeps the height of the higher MC even if it is not visible, so i need to set "scroll just 300 pixel" as I click on a button. Is there a way to do that still keeping the scrollpane component active (and not writing a custom scroller)?
Thanks
Nadia
Yeah everything visible or not counts in dimensions. You can simply resize the bigger clip when it's not visible so it's smaller than the visible clip.
Related
I have a bunch of horizontal scrolling components stacked on top of each other. When I click one, the browser knows that is the "selected" scroller, and left/right arrow keys will start scrolling that component.
I've tried every element state in dev tools, and haven't been able to find one that correlates with this action. Does anyone know what this state is that I can use?
End goal is to change background color of the "active" scroller (it's not active, I tried!)
I wish to create a hidden frame,from which I wish to control the navigation of visible frame (like showing the content in it from different urls depending upon some logic in hidden frame)
Is it possible?
Thanks
It is possible but if you do that most probably your webpage/website will be detected as harmful page!
First off, I'm pretty novice when it comes to Flash and AS3.
I am trying to create a displayObject that contains 12 buttons for a mobile app. Since there are twelve buttons that will all open up into seperate menus they obviously all won't fit on a mobile devices screen. This is why I want to have all of the buttons on one display object that can be dragged up and down to show the buttons not currently displayed on the screen.
I am running into numerous problems while attempting this.
1) If I make the object containing the buttons draggable, which is behind the buttons, I can't click it through the buttons in order to drag it(unless I hit a sweet spot where there aren't any buttons but this isn't efficient for the user).
2) If I make the object containing the buttons draggable and put it in front of the buttons then I can't click the buttons in order to open the menus and access what is contained within them.
3) For some reason all of the buttons are seperately draggable when I don't want them to be. For example, I click anywhere on the screen (whether the touchID point is on a button or not) to move the entire list of buttons and if I happen to be clicking a button then, instead of moving the entire list, it moves that one button.
So the main question here is "How can I create a list of buttons and scroll through the list using a drag method (such as the settings menu on your phone) without dragging the buttons apart from each other." So the containing display object is draggable, and the buttons are clickable.
Some guy named Glenn does a good job with his example: http://rabidgadfly.com/2010/03/as3-clickable-button-inside-a-draggable-movie-clip/
However, if you click the yellow button in his example you can drag it out of the gray box. I want my button to remain stationary relative to the gray box. So you can move the gray box but the yellow button remains in the same location within the box but you cant drag the button around within the box.
I am not familiar with accelerometer events for the smartphones, but I do have an idea on how to fix this with regular actionscript 3 listeners. (You can just convert these to whatever is used by smartphone listeners)
A solution that comes to mind is to have a mouse down listener and a mouse up listener on the whole drag-able box. And when a mouse down event fires, you start a timer to go off in about a quarter of a second, and when it does you then set up a enter frame (or a timer based) function that fires every frame. This will update the whole box's position every frame corresponding to the current mouse location (your dragging box effect) and when the mouse up listener fires, it stops the dragging (and at this points, if the mouse is up, then the user is not touching the screen at all).
Also add a mouse click listener to every button. This way, with the quarter of a second timer, you KNOW that if the user simply wants to click a button, then they will click, leaving less that a quarter of a second between the mouse down and mouse up events (so that the dragging never starts) and the button is only clicked. And if the user holds the mouse down for more than a quarter of a second, then you KNOW that they must be trying to drag the whole thing.
This seams like the only way to differentiate between a user wanting to drag the box, and the user wanting to click a button inside it.
Obviously it does not have to be a quarter of a second, it can be any length of time that you want, it could even be no time at all, but then this might mess up things when people only want to click the button and accidentally slides it when clicking.
If you have any questions or problems, please comment and i'll try to help.
I have a floating toolbar with tools buttons in it. The toolbar itself is draggable using its header with title "Basic tools". Below the toolbar there is a workspace filling the whole page. Buttons on the toolbar are draggable too and droppable to the workspace. When I drag/drop a button to the workspace, it turns into a rectangle widget with some content in it.
My issue is that I want an icon to be dropped only when it's over the gridded workspace, not over the toolbar. I have added console.log to track Draggable/Droppable events and it seems that the workspace emits drop event event if I drop the element on the toolbar. I suppose it's because the workspace is below the toolbar. So, when it's being dropped on the toolbar, it should revert back to its initial position in the toolbar.
You have to determine where the tool is dropped: How do I get the coordinate position after using jQuery drag and drop?
You also have to determine where your toolbox is placed: http://api.jquery.com/position/
Then you have to determine the width and height of your toolbox: http://api.jquery.com/width/
After that calculate the rectangle of your toolbox and check if the tool is placed there. If it is placed there then deny dropping, if not allow dropping.
My apps pops up a dialog. Users usually want to switch back and forth between this dialog and the application window for a period of time. I want this dialog to stay on top, so that it doesn't get hidden behind the main application window. But at the same time I want the dialog to have a minimize button so that it can get out of the way if it's not needed for a while.
Here is what I've tried:
use a modeless JDialog - the dialog stays in front nicely, but it doesn't not have a minimize button, and it doesn't have its own taskbar button either
use a JFrame - the dialog now has a minimize button and its own taskbar button, but when the main window gets focus the dialog is hidden behind it.
use a JFrame and add WindowListener.windowDeactivated() { this.toFront() } on the dialog. The problem with this is that toFront() also sets the focus, so that you get a weird focus flickering effect.
use a JFrame with setAlwaysOnTop - this is the neaerest solution, but now the window will stay on top of all other applications, not just my application.
It would be easy if toFront just brought the JFrame to the front without changing the focus, but unfortunately that is not the case. Is there another way to change JFrame Z-order?
edit: It just occurred to me that if there were an easy way to "roll-up" a JDialog, i.e. minimize it but not to the taskbar, that would solve my problem too.
Why not listen for the focusGained event in the frame and then use setZOrder/toFront on the dialog at that point? (Not sure this will work but worth a shot).