Discussion:
Alert not coming up in a centered fashion.
(too old to reply)
Daniel Cascais
2005-06-07 20:29:21 UTC
Permalink
I have done an application that uses an Alert Window. I am using the
same swf file for two different resolutions (1024x768 and 800x600).
The two different versions have a different size (430x402 and
341x320). I am using Stage.width and Stage.height to reposition all
the objects; depending on the size that it should be adapting to, (I
am only using one file for both occasions).

In the IDE, the alert pops up in the center of the stage in both the
sizes, but in the browser (inside an Iframe) the alert pops up in the
center of the size given to the swf in the IDE, instead of using
Stage.width and Stage.height to center it. As there is no mean to
control where the alert pops up, maybe you could help me figure how to
make it appear centered in both occasions.

If you have any idea on what I should be doing to fix this little
issue I would really appreciate it.

Thanks,
Daniel
Duncan Reid
2005-06-07 22:45:08 UTC
Permalink
Hi Daniel,

maybe something like:

var stuff = mx.controls.Alert.show("Hello, world!");
stuff.move(Stage.width/2 - stuff.width/2,Stage.height/2-stuff.height/2);

hope this helps some,
Dunc
Post by Daniel Cascais
I have done an application that uses an Alert Window. I am using the
same swf file for two different resolutions (1024x768 and 800x600).
The two different versions have a different size (430x402 and
341x320). I am using Stage.width and Stage.height to reposition all
the objects; depending on the size that it should be adapting to, (I
am only using one file for both occasions).
In the IDE, the alert pops up in the center of the stage in both the
sizes, but in the browser (inside an Iframe) the alert pops up in the
center of the size given to the swf in the IDE, instead of using
Stage.width and Stage.height to center it. As there is no mean to
control where the alert pops up, maybe you could help me figure how to
make it appear centered in both occasions.
If you have any idea on what I should be doing to fix this little
issue I would really appreciate it.
Thanks,
Daniel
_______________________________________________
Flashcoders mailing list
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
Dunc
Daniel Cascais
2005-06-08 21:50:43 UTC
Permalink
Thanks for your reply Duncan, but oddly enough, it didn't work.

I'm slightly confused with the fact that there is no
possible/documented way to control the positioning of the Alert.
Post by Duncan Reid
Hi Daniel,
var stuff = mx.controls.Alert.show("Hello, world!");
stuff.move(Stage.width/2 - stuff.width/2,Stage.height/2-stuff.height/2);
hope this helps some,
Dunc
Post by Daniel Cascais
I have done an application that uses an Alert Window. I am using the
same swf file for two different resolutions (1024x768 and 800x600).
The two different versions have a different size (430x402 and
341x320). I am using Stage.width and Stage.height to reposition all
the objects; depending on the size that it should be adapting to, (I
am only using one file for both occasions).
In the IDE, the alert pops up in the center of the stage in both the
sizes, but in the browser (inside an Iframe) the alert pops up in the
center of the size given to the swf in the IDE, instead of using
Stage.width and Stage.height to center it. As there is no mean to
control where the alert pops up, maybe you could help me figure how to
make it appear centered in both occasions.
If you have any idea on what I should be doing to fix this little
issue I would really appreciate it.
Thanks,
Daniel
--
Dunc
Duncan Reid
2005-06-09 04:45:21 UTC
Permalink
Hi Daniel,

agreed it is confusing. To be honest i haven't used the alert
component much but from what i understand from the docs is that it
centers itself in the parent window if "parent" is supplied. If you
supply undefined or null it's parent will be _root and should center
itself on _root. If you follow the chain from Alert which extends
Window which extends ScrollView which extends View which extends
UIComponent which extends UIObject who holds the move method.

The code i posted was just slapped on frame 1 with an alert component
in the library, which i was sure to test as to not look like a jackass
:-). how are you invoking the Alert component?

Dunc
Post by Daniel Cascais
Thanks for your reply Duncan, but oddly enough, it didn't work.
I'm slightly confused with the fact that there is no
possible/documented way to control the positioning of the Alert.
Post by Duncan Reid
Hi Daniel,
var stuff = mx.controls.Alert.show("Hello, world!");
stuff.move(Stage.width/2 - stuff.width/2,Stage.height/2-stuff.height/2);
hope this helps some,
Dunc
Post by Daniel Cascais
I have done an application that uses an Alert Window. I am using the
same swf file for two different resolutions (1024x768 and 800x600).
The two different versions have a different size (430x402 and
341x320). I am using Stage.width and Stage.height to reposition all
the objects; depending on the size that it should be adapting to, (I
am only using one file for both occasions).
In the IDE, the alert pops up in the center of the stage in both the
sizes, but in the browser (inside an Iframe) the alert pops up in the
center of the size given to the swf in the IDE, instead of using
Stage.width and Stage.height to center it. As there is no mean to
control where the alert pops up, maybe you could help me figure how to
make it appear centered in both occasions.
If you have any idea on what I should be doing to fix this little
issue I would really appreciate it.
Thanks,
Daniel
--
Dunc
_______________________________________________
Flashcoders mailing list
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
Dunc
Daniel Cascais
2005-06-09 14:49:13 UTC
Permalink
Duncan:

Thanks for your time...

This is a 1 frame application, and when required I call the Alert
through a method.

I was doing it this way:
//
Alert.show("... something ...", "... something ...");

I am doing it this way now (as in your example), but I get the same
problem as before, almost as if the second line is ignored by the
player, just to bug you.
//
var alert = Alert.show("... something ...", "... something ...");
alert.move(Stage.width * .5 - alert.width * .5, Stage.height * .5 -
alert.height * .5);

I also went through the Class chain, having similar findings to
yours... and no results were to be found.
Post by Duncan Reid
Hi Daniel,
agreed it is confusing. To be honest i haven't used the alert
component much but from what i understand from the docs is that it
centers itself in the parent window if "parent" is supplied. If you
supply undefined or null it's parent will be _root and should center
itself on _root. If you follow the chain from Alert which extends
Window which extends ScrollView which extends View which extends
UIComponent which extends UIObject who holds the move method.
The code i posted was just slapped on frame 1 with an alert component
in the library, which i was sure to test as to not look like a jackass
:-). how are you invoking the Alert component?
Dunc
Post by Daniel Cascais
Thanks for your reply Duncan, but oddly enough, it didn't work.
I'm slightly confused with the fact that there is no
possible/documented way to control the positioning of the Alert.
Post by Duncan Reid
Hi Daniel,
var stuff = mx.controls.Alert.show("Hello, world!");
stuff.move(Stage.width/2 - stuff.width/2,Stage.height/2-stuff.height/2);
hope this helps some,
Dunc
Post by Daniel Cascais
I have done an application that uses an Alert Window. I am using the
same swf file for two different resolutions (1024x768 and 800x600).
The two different versions have a different size (430x402 and
341x320). I am using Stage.width and Stage.height to reposition all
the objects; depending on the size that it should be adapting to, (I
am only using one file for both occasions).
In the IDE, the alert pops up in the center of the stage in both the
sizes, but in the browser (inside an Iframe) the alert pops up in the
center of the size given to the swf in the IDE, instead of using
Stage.width and Stage.height to center it. As there is no mean to
control where the alert pops up, maybe you could help me figure how to
make it appear centered in both occasions.
If you have any idea on what I should be doing to fix this little
issue I would really appreciate it.
Thanks,
Daniel
--
Dunc
--
Dunc
Duncan Reid
2005-06-09 21:47:56 UTC
Permalink
Hi Daniel,

sorry for my crappy response time.. Can you get it to work from a
blank test movie, setting it to 0, 0 or some other number? I have
this working below, puts the alert top left corner, wondering why it's
not working for you though.

import mx.controls.Alert;
import mx.utils.Delegate;

var stuff = Alert.show("error message", "information", Alert.OK |
Alert.CANCEL, null, Delegate.create(this, callBack), icon, Alert.OK);
stuff.move(0,0);

function callBack(){
trace("Alert Clicked");
}

Dunc
Post by Daniel Cascais
Thanks for your time...
This is a 1 frame application, and when required I call the Alert
through a method.
//
Alert.show("... something ...", "... something ...");
I am doing it this way now (as in your example), but I get the same
problem as before, almost as if the second line is ignored by the
player, just to bug you.
//
var alert = Alert.show("... something ...", "... something ...");
alert.move(Stage.width * .5 - alert.width * .5, Stage.height * .5 -
alert.height * .5);
I also went through the Class chain, having similar findings to
yours... and no results were to be found.
Daniel Cascais
2005-06-09 23:02:11 UTC
Permalink
DonĀ“t worry about the response time, we are probably on very different
time zones.

I'm going to test out what you mention, and I'll give you some
feedback tomorrow.

Thanks,
Daniel
Post by Duncan Reid
Hi Daniel,
sorry for my crappy response time.. Can you get it to work from a
blank test movie, setting it to 0, 0 or some other number? I have
this working below, puts the alert top left corner, wondering why it's
not working for you though.
import mx.controls.Alert;
import mx.utils.Delegate;
var stuff = Alert.show("error message", "information", Alert.OK |
Alert.CANCEL, null, Delegate.create(this, callBack), icon, Alert.OK);
stuff.move(0,0);
function callBack(){
trace("Alert Clicked");
}
Dunc
Post by Daniel Cascais
Thanks for your time...
This is a 1 frame application, and when required I call the Alert
through a method.
//
Alert.show("... something ...", "... something ...");
I am doing it this way now (as in your example), but I get the same
problem as before, almost as if the second line is ignored by the
player, just to bug you.
//
var alert = Alert.show("... something ...", "... something ...");
alert.move(Stage.width * .5 - alert.width * .5, Stage.height * .5 -
alert.height * .5);
I also went through the Class chain, having similar findings to
yours... and no results were to be found.
Daniel Cascais
2005-06-10 20:36:34 UTC
Permalink
Duncan:

Good news, the thing is working now! Problem was that another
developer here had set the align parameter in the object/embedd code
to "middle", bugging up the "TL" Stage align set in the code.

Good thing is that I now know how to position the Alert component by
an absolute value.

Thanks for your help.
Post by Duncan Reid
Hi Daniel,
sorry for my crappy response time.. Can you get it to work from a
blank test movie, setting it to 0, 0 or some other number? I have
this working below, puts the alert top left corner, wondering why it's
not working for you though.
import mx.controls.Alert;
import mx.utils.Delegate;
var stuff = Alert.show("error message", "information", Alert.OK |
Alert.CANCEL, null, Delegate.create(this, callBack), icon, Alert.OK);
stuff.move(0,0);
function callBack(){
trace("Alert Clicked");
}
Dunc
Post by Daniel Cascais
Thanks for your time...
This is a 1 frame application, and when required I call the Alert
through a method.
//
Alert.show("... something ...", "... something ...");
I am doing it this way now (as in your example), but I get the same
problem as before, almost as if the second line is ignored by the
player, just to bug you.
//
var alert = Alert.show("... something ...", "... something ...");
alert.move(Stage.width * .5 - alert.width * .5, Stage.height * .5 -
alert.height * .5);
I also went through the Class chain, having similar findings to
yours... and no results were to be found.
Loading...