Notification when the stage is vissible on the screen
Hi all,
I'm creating a JavaFx application which is a client application that interacts with an server. I created a preloader like scene which shows the progress (with a progress bar) when the application receives a broadcast from the server with server location, application initialization and when started for the first time the user must give a client name. I do not use the preloader interface because it seems to be discarded on the raspberry pi (correct me if i'm wrong, but i'm using a log file and nothing is written to the file from the preloader i created before this attempt).
This all works fine, user can do input, and when te client starts for the second time and later, the client automaticaly logs in. When i start this client on my development machine i see the preloader scene starting from the beginning. But when i start the same application on the raspberry pi (which offcourse is a LOT slower), the preloader scene is not earlier visible then when:
- The client receives the broadcast from the server after 4/5 seconds, because the application is then in a "wait" state.
- Or when the broadcast is recieved quite fast, when there is user input needed,
- When the broadcast is recieved quite fast and there is no user input needed, i rarely see the preloader scene appearing.
I've understand that there is a main FX thread for graphical actions and there are you're own threads etc... I have the following code to start the application initialization progress when the preloader scene comes visible in my application start method:
public void start(Stage primaryStage) {
redirectOutputToLog();
rootStage = primaryStage;
rootStage.setTitle("PiDome Client");
rootStage.setFullScreen(true);
rootStage.initStyle(StageStyle.UNDECORATED);
rootStage.addEventHandler(WindowEvent.WINDOW_SHOWN, new EventHandler<WindowEvent>(){
@Override
public void handle(WindowEvent window){
if(preloaderShown==false){
mainStage = new MainScene();
mainStage.setRoot(rootStage);
ready.addListener(new ChangeListener<Boolean>(){
@Override
public void changed(
ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
if (Boolean.TRUE.equals(t1)) {
rootStage.setScene(mainStage.scene());
////rootStage.sizeToScene();
Networking.removeEventListener(me);
ClientData.removeClientDataConnectionListener(me);
ClientData.removeClientLoggedInConnectionListener(me);
Domotics.removeDomoticsListener(me);
preloader = new PidomeClientPreloader(rootStage);
rootStage.show();
preloaderShown = true;
initialize();
The constructor of the PidomeClientPreloader is creating the preloader scene and puts all the items on the scene as needed. When the preloader is done initializing the rootStage is shown. But as mentioned on the raspberry pi, the event WINDOW_SHOWN seems to be fired before the scene is graphical visible. I'm not using Platform.Runlater in my preloader code (only in one update function to update the progress bar from background threads).
Is there a way to have a absolute way of determining when a scene is really visible, or is this as far as i can get because the FX thread is always running behind?
Thnx in advance,
John.
There are four general causes of this issue:
1. The computer's PRAM no longer contains a valid startup disk setting when there aren't any problems with the disk itself. This can be checked for by pressing the Option key and seeing if the drive appears.
2. The internal drive's directory structure has become damaged. This requires usage of an alternate bootable system to perform the repair.
3. Critical system files have been deleted. This requires usage of an alternate bootable system to reinstall them.
4. The internal drive has died or become unplugged. This is the most likely case if the computer took a sharp impact or there are unusual sounds coming from the hard drive's location.
(66725)
Similar Messages
-
A notification when an alias device occurs in the LMS 4.0
Hi all,
is possible to send notification (for example email notification) when an alias device occurs in the LMS 4.0? Thank you.
RomanNo, this is not possible. You will have to periodically check to see if a new alias is found.
-
How to receive notifications when a review is made in the app store on our App
Do the app stores provide a mechanism for app publishers to receive notifications when a review is made in the app store?
Thanks!!Hi Friend,
You just write down the name of the app or for what the app is used for (eg, write down Notes and then will appear a lot of options), then download what you wish.
Hope it will be helpful -
I have an upgrade question. I received a notification when I connected my computer to the internet that Lightroom 5.7.1 was available it included HDR & Panoramic photo merge. I cant find these. Where do I find them.
well that was a big waste of my time & data allowance then ...
I live in a flaky slow internet area & I keep my photo edit machine off the internet unless & want to update something. CC is no use to me & that useless update just used up a 12th of my allowance for the year ... -
Revision: 10826
Author: [email protected]
Date: 2009-10-02 10:28:43 -0700 (Fri, 02 Oct 2009)
Log Message:
When a Video is removed from the stage or becomes invisible, the video will now pause playback. This features is controlled through a new property, playWhenHidden, which defaults to false (meaning we don't play the video when it's hidden). When it becomes visible/on-stage again, we will start playing the video if autoPlay=true. Otherwise, the video will not automatically start playback.
This property still needs to be reviewed by PARB.
Also, updating a comment in SkinnableContainer relating to a FIXME I own.
QE notes: -
Doc notes: -
Bugs: SDK-21928
Reviewer: Deepa
Tests run: checkintests, mustella VideoElement/VideoPlayer
Is noteworthy for integration: Yes
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-21928
Modified Paths:
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/SkinnableContainer.as
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VideoPlayer.as
flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/VideoElement.asIs this the same trouble you are having?
http://discussions.apple.com/thread.jspa?threadID=826805&tstart=0
DP G5 2GHz -
A week ago, the Mail app wouldn't display any messages. After restarting the phone, it still would not display any messages, it would just quit. Then eventually it opened with messages displayed. But then Mail notifications disappeared, and is not even listed in the Notification Center. How can Mail be "re-listed"?
I checked some other discussions and doing a reset by holding the power and home button helped the Mail app to appear in the Notifications list again
-
Why does the stage layout change when native menu added
I have a program that was fine till I added a native menu to it. After adding the menu I have a space on both the left and the right of the stage. If I draw a shape at x=0, y=0 it appears about 40 pixels to the right of the window border. If I remove the menu the space still occurs what is going on?
Adding the menu shrinks the effective size of the stage. This happens because in the app descriptor, you set the outer size of the window, not the stage size. When you add a menu, the space for the menu is created by removing space from the stage, not by increasing the height of the window.
You see the bars around the app because you have the stage scalemode set to something other than noScale.(noScale is NOT the default.) The other scale modes attempt to keep most or all of the app in view when the app is not the same size as the stage (which happens when you add a menu to a window). The space around the edge is the result of the runtime scaling your content into the available space When you remove the menu, this space should be returned to the stage -- and does in my tests, so I can't explain why you don't see the scaling go away. Perhaps you are drawing your content based on the reduced stage size so you still have extra space after the menu is removed.
The stage align property determines how the content is positioned on the stage when it is scaled down. The default is center which distributes space to either side when the stage is scaled horizontally, which is why the origin effectively moves away from the left side of the window. If you used the an AlignMode of top left, the origin would stay in the top left corner.
In general, I recommend setting the stage scaleMode to noScale in an application, unless you have a specific need for one of the other scale modes. Even then, you can still scale things programmtically using logic appropriate to the situation. The other modes were designed for use in a browser where the SWF author may not have control of the stage and so must choose the least-bad compromise. In an AIR app, you have control and so don't need to make that compromise. -
How do I make the stage transparent when published?
Hi. I'm new to flash and want to work towards making 2D animations.
I want to take a simple published animation and put it into SONY VEGAS. However, I only want the character (I've created a symbol for it) and not the big white stage. My goal is to get the animated character on top of all my sony vegas layers, but the stage is blocking all the other layers. Is there some kind of setting that can make the stage transparent when publishing as a SWF?hi
you need to add some markup to your html:
add <param name="wmode" value="transparent"> to your <object> tag and add wmode="transparent" to the <embed> tag
the feature isn't supported by all browsers and it may cause your swf to slow down a bit if there's a lot going on visually. -
How to keep the stage aspect ratio when stage width=100%?
Hey,
if I would like to make an animation that always fits into the browser window by fitting the width to 100% I'm having trouble keeping the aspect ratio of the stage's height. I can only configure 100% there which will stretch the content also to 100% of the browser window's height. If I configure a pixel value for the height, then I am also stuck on this value.
All I want is the stage to adjust to the width of the browser window, and the height of the stage to preserve the aspect ratio depending on the width.
this video shows what I mean. unfortunately I am not familiar with coding: http://www.youtube.com/watch?feature=player_embedded&v=hrLt0Y9QAY8
Can somebody help me?sorry can't get the code working properly onwith the html code function. Sorry for that
-
How to dynamically duplicate an item on the stage
Hello,
I have a box (lets call it 'xBox') on the stage that contains
a couple comboboxes and buttons.
One of the buttons (labelled 'add new search feature') when
clicked will duplicate the whole box 'xbox' and give it a new
unique name that can be referenced. So, now there would be two
boxes on the stage that look exactly the same.
You can click the 'add new search feature' button repeatedly
and each time a new 'xbox' will appear at the bottom below the
previously created 'xbox's....
I have played with states some, but am unsure how that would
apply to an infinite amount of new 'xbox's being created.
Is this possible? Any help is greatly appreciated.
here is the code:
<mx:Box direction="horizontal" borderStyle="solid"
paddingTop="10" paddingBottom="10" paddingLeft="10"
paddingRight="10">
<mx:ComboBox id="xField" width="100%">
<!-- An inline data provider -->
<mx:Array>
<mx:Object data="0" label="Yards gained" />
<mx:Object data="1" label="Shotgun" />
<mx:Object data="2" label="TD" />
<mx:Object data="3" label="Down" />
<mx:Object data="4" label="Leading" />
<mx:Object data="5" label="Quarter" />
<mx:Object data="6" label="Turf/grass" />
<mx:Object data="7" label="Stadium type" />
<mx:Object data="8" label="Home" />
<mx:Object data="9" label="Opponent" />
<mx:Object data="10" label="Month" />
<mx:Object data="11" label="Season" />
</mx:Array>
</mx:ComboBox>
<mx:ComboBox id="argument" width="100%">
<!-- An inline data provider -->
<mx:Array>
<mx:Object data="0" label="Equals" />
<mx:Object data="1" label="is greater" />
<mx:Object data="2" label="is less" />
<mx:Object data="3" label="is not" />
</mx:Array>
</mx:ComboBox>
<mx:TextInput id="enter_data"/>
<mx:Button label="Search"/>
<mx:Button label="Add new Search Feature"/>
</mx:Box>Okay, what you want to do is, make a custom component out of
the xBox. Then in your main application you wan to make an array of
objects. Every time the button (to add xBoxes) is clicked add one
to the array, then also add it to the main app's list of children.
You want to add it to the array so that you can still reference it.
Try something like this:
import xBox;
import mx.collections.ArrayCollection;
private var xBoxArray : ArrayCollection = new
ArrayCollection();
private var location : int = 1;
private function buttonClickHandler() : void
var temp : xBox = new xBox ();
xBoxArray.addItemAt ( location, temp );
whereYouWantTheXBoxesToGo.addChildAt ( location,
xBoxArray.getItemAt ( location ) );
<mx:Button click="buttonClickHandler()"
label="More xBoxes" id="360" />
<mx:Box id="whereYouWantTheXBoxesToGo"/>
<!--
-->
This is just a rough guide of what to try. But something like
this should work. -
Adding objects to the stage & acceessing stage properties - I'm a bit confused..
Hi,
I'm a little confused on two fronts regarding display
programming:
A. What the best way to add objects to the stage?
B. How to access stage properties.
I can do both of these when the project is an 'Action Script
Project', but I'm having trouble when it is a 'Flex Project' (e.g.
an MXML file). See the two attached files with questions included
in the comment to see exactly what I mean.
A. What the best way to add objects to the stage?
=====================================
In an action script project that extends Sprite I can just
call addChild()
In an MXML project I can add objects to the stage by first
adding them to a UIComponent, then adding that to the stage.
1. Is that the best way to do it?
In this doc:
http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html
it says that
quote:
Each SWF file has an associated ActionScript class, known as
the main class of the SWF file. When Flash Player opens a SWF file
in an HTML page, Flash Player calls the constructor function for
that class and the instance that is created (which is always a type
of display object) is added as a child of the Stage object. The
main class of a SWF file always extends the Sprite class
2. why cant I just add a sprite object direct to the stage
without the UIComponent?
3. What is the 'main class', and how can i get access to it?
B. How to access stage properties.
=========================
In an action script project that extends Sprite I can just
call trace(stage.framerate)
But in an MXML file I cannot figure out how to access the
stage properties.
See the attached code for the things that I tried, but which
didnt work.
In the page:
http://www.actionscript.org/forums/showthread.php3?t=140655
It says
quote:
For stage access you have a couple of rules:
* natively, only display objects have inherent access to
stage
* display objects only have a valid reference to stage if
they're within the stage's display list (on the screen, after added
to it with addChild)
* The only display objects which immediately have access to
the stage before the use of addChild (in their constructor) are the
document/application class instance (root) and any instance from
the library placed on the timeline (not created with AS).
* Non-display object classes have to be passed or assigned a
reference to the stage from another object which already has access
to it - they cannot access it otherwise.
4. How do I access the stage properties in the MXML project?
5. I suspect this is related to the "main class", which I
dont yet understand - is it?
Sorry for the long post.
cheers
tom"tom saffell" <[email protected]> wrote in
message
news:gd7cm9$d1v$[email protected]..
> Thanks Luigi - that helps a lot.
> I hadnt seen the Flex 3 Developer Guide before - it's
very useful.
>
> I now see that I can access properties of the
application object directly
> with
> this.<property>.
> However, the framerate property cannot be set by
actionscript, only in
> MXML (I
> can set it in the <mx:application> tag). But I
need to be able to set it
> programatically, dependent on user input.
>
> 5. Is there a way around this?
> 6. Can I set the stage's framerate to achieve the same
outcome?
>
> I still dont understand why I cannot access the stage
object. When I call
> either
this.stage or
uic.stage * then I get
quote:
Cannot access
> a
> property or method of a null object reference.
My understanding is
> that I
> can access the stage object via any display object on
the display list.
> I'm
> confused about this bit..
>
> * - uic is a UIComponent that has been added to the
display list (i think)
> by
> calling addChild(uic) from the AS3 within the
application
>
> 7. How do I access stage properties in AS3 in an MXML
project?
http://www.adobe.com/livedocs/flex/3/html/help.html?content=05_Display_Programming_10.html
It seems like possibly your real problem is that you're
having trouble
searching the Help effectively:
http://flexdiary.blogspot.com/2008/07/getting-help-in-flex-builder.html -
Accessing display objects via the stage var
I'm passing a stage reference to my class, but when I try to
access a movieclip on the stage I get an error.
this gives me an error:
var mc = targetStage.myMovieClip;
Thanks!var myClass = new MyClass (this.stage);
That would be the same thing, this.stage would refer to the
Stage instance. Each .swf has one Stage instance. In a Flash
project, the stage has one child, the MainTimeline instance.
MainTimeline is basically a big MovieClip, and it contains all your
objects, scenes and timelines you create in Flash.
So, if you instantiate from the main timeline itself (either
on a frame script or Document class) you are already inside
MainTimeline, which is what you want to pass along a reference to,
so you would pass in "this" as Colin said, or "root".
Colin mentioned that MovieClip(root) would work anyway; if I
understand he is referring to the fact that every DisplayObject
(such as MovieClips and SimpleButtons created in Flash) already
have a "root" property that usually refers to the MainTimeline
instance. However, your class "MyClass" does not extend
DisplayObject so there is no root property available, which is why
you need to manually pass in a reference to the root
timeline. -
What happens to the stage if I get directions via Maps
Simple fact:
1. I'm using my Director-developed iOS iPhone app
2. I switch to Maps
3. I get directions
4. When I switch to my app the stage is smaller and the upper side of if is occupied by the green status of Maps turn-by-turn indicator
5. I return to Maps and turn off turn-by-turn indications
6. I return to my app and... et voilà: the stage is shifted down by 20 pixel (40 on retina devices).
I think it's a bug.
But I suppose Apple will never let me sell/giveavay my ap via their Store because of it...
Thanks.Hi Alex,
window(1).rect seems to sometimes work under iOS.
on activateApplication
if window(1).rect.top > 0 then
window(1).rect = _system.deskTopRectList[1]
end if
end
SHOULD re-centre the window (assuming your movie has the same dimensions as the screen)
Unfortunately the "on activateApplication" handler only seems to work when the iDevice is woken, instead of when the Director app is brought to the front.
Also the "window(1).rect" function notes changes within the handler that resets window(1).rect, but doesn't seem to notice the change later on.
Later calls to window(1).rect.top always return 0.
However "window(1).rect = _system.deskTopRectList[1]" seems to work consistently. -
How to tell who is on the Stage?
How can I tell which movie currently is on the Stage, to be
able to remove
it?
For example, I have 3 buttons on the stage:
button "Banana"
button "Apple"
button "Orange"
When I press "Apple", the movie clip "ApplePie" is attached
to the movie
container on the stage:
_root.Banana.onRelease = function(){
_root.MovieContainer.attachMovie("ApplePie","ApplePie",1,
{_x:0, _y:0});
Now, if I press Orange, I want to remove previous movie clip
from the stage
and attach new - "OrangePie".
But how can I know what movie clip is currently on, to be
able to remove it?
I may have 50 buttons, and I can't know which of them was
pressed
previously..
Any ideas?
Thanks in advance,
B.Thanks :)
I didn't know that loading another movie would remove
previously loaded..
"Rob Dillon" <[email protected]> wrote in message
news:fv4gou$bi3$[email protected]..
> You can create a variable to hold the name of the
currently loaded movie.
> If you only need one movie on the stage at any time,
then just have one
> movieClip on the stage that you load the others into.
>
> If as in your example code, everything is loaded into a
clip named
> MovieContainer, then you don't need to unload the
current movie. Loading a
> new
> movie into the same movieClip will remove the current
movie by default.
> -
Check for Children on the Stage at point x,y?
Hi --
I am wondering if there is a way to determine, when the mouse
is pressed, if
the mouse is over a child object on the stage or over just
the "blank"
stage. Is there any way to do this?
Thanks
RichHi --
I modified your code slightly to attempt to use the "stage"
as the thing I
am testing for hit on a child but all I keep getting as a
"hit" is "root1".
I have this code inside my mouse down event handler..
for (var i:int=0; i<stage.numChildren; i++) {
if (stage.getChildAt(i).hitTestPoint(mouseX,mouseY)) {
trace(stage.getChildAt(i).name);
Is the problem with having it inside a mouse down event? Or
is my code not
right because I want to check the stage?
Thanks
Rich
"kglad" <[email protected]> wrote in message
news:fedlr6$86s$[email protected]..
> :
>
>
>
> var tl:MovieClip=this;
> stage.addEventListener(MouseEvent.CLICK,f,false,0,true);
> function f(evt:MouseEvent) {
> for (var i:int=0; i<tl.numChildren; i++) {
> if (tl.getChildAt(i).hitTestPoint(mouseX,mouseY)) {
> trace(tl.getChildAt(i).name);
> }
> }
> }
>
Maybe you are looking for
-
Digitizing DVCPro 50 and Mini DV with the red line
I've digitized from DVCPro 50 with Capture Settings at DV 50 NTSC 48khtz and Video Playback at DV 50 NTSC 48khtz and Playback firewire 720x480. Now I'm digitizing the Mini DV portion (Broll) with Capture Settings at DV NTSC 48khtz and Video Playback
-
Not sure if this is the right board to post this query.. Just updated my OS and not able to see facebook in my hub.. no notifications and not able to compose messages either. How do I get it back? Thanks.
-
URGENT: servlets in weblogic.
I am trying to run the servlets in bea weblogic server 6.1.. but when it gives "405- Resource not allowed." ..error..I have double checked all the files and my XML code in web.xml file ..but no luck.... can anyone please help?
-
Transports while importing DS error "Source system QAS does not exit "
Hi Experts, For a specific reason we are importing a DS from quality to development.While importing DS in Development side we are getting an error " Source system QAS does not exist".Error message as below: Start of the after-import method
-
Acrobat XI quit working. I uninstalled it then went to Creative Cloud to reinstall CC failed to reinstall Error code 50 help