Spawning A New Window Maximized
ok.... here it goes.... I need to make a button in flash that will spawn a new wimdow maximized ( NOT FULL SCREEN ).. I would perfer if the window would be a _self window insted of a _blank window .. but I will take what I can get. I believe you can do it in java... I've tried different methods and they all blew.. PLEASE HELP ME.. All I need id the script for the html and the actionscript in the fla....
I hope I'm not asking too much...
Thanks Aaron
FlashKit > Flash Help > Flash ActionScript
Posted on: 10-21-2002, 08:21 PM
View Complete Forum Thread with Replies
Sponsored Links:
Maximized Window How Is It Really Done ?
Yes hi this is something i think allot off people have asked in the past and im in away new to flash. I need to create the effect that opens your web site on the users command to full screen so it hides your task bar and also browser menu but im not sure on how to create this. I have tested the
on (release) {
fscommand ("fullscreen", "true");
}
And cant seem to make this work. Am i doing something wrong here ?? or is this the right code but im missing something else ??
Im obviously adding that code to a button and uploading the swf to my server and all is well apart from the full screen mode.
I need ay help to be clear and as simple as possible or even if there is a tutorial i could look at that would be even better for me.
Thanks.
Mental
View Replies !
View Related
Launch Window Maximized?
ok, I have a button in my flash movie that launches a new window... & I can't for the life of me find a way to ensure that the window that is launched is maximized (not fullscreen, just your usual maximized window) so users don't have to maximize the window themselves...
is there any way to do this? (I'm using the "on (release) {getURL ("http://www.insertsitenamehere.com", "_blank");)" script in the button, if it helps any)...
View Replies !
View Related
Opening Browser Window As Maximized
Hello. I am new to Flash and new to this forum. I am developing a Flash application that has links from the movie to other URLs. I wish to have the URL open in a MAXIMIZED window rather than the default I now get. Is there a way to do this and if so, how is it done? Thanks for any and all suggestions.
View Replies !
View Related
Opening A Blank Maximized Window
Hey people,
I want to open a HTML page which should be opened in a blank window so I added the "_blank" in the code:
ActionScript Code:
on (release) { getURL("http://b3site.quid.nl/", "_blank");}
Does anyone know the code to maximize the window?
Thnx in adv.
Grtz CoDe-ReD.
View Replies !
View Related
Opening A Blank Maximized Window
Hey people,
I want to open a HTML page which should be opened in a blank window so I added the "_blank" in the code:
ActionScript Code:
on (release) { getURL("http://b3site.quid.nl/", "_blank");}
Does anyone know the code to maximize the window?
Thnx in adv.
Grtz CoDe-ReD.
View Replies !
View Related
Open Link In A Maximized Window
how do i open a link in a maximimized window?
this is what i am obviously using right now:
ActionScript Code:
on (release) {
getURL("http://www.someURL.com/", blank);
}
but any help would be greatly appriciated
thanks!
austin
View Replies !
View Related
Spawning More Than One Window
hello,
i am running a spawn window script from my swf but each time i try to spawn a new window it just opens the window in the already spawned window,
so i have a main swf and from there i need to spawn more than one window say 5 or so, the first one opens up fine but all rest all load in the first window i spawned
can anyone please help?
adam
View Replies !
View Related
GetURL Page To Load In Maximized Window?
Hello again, simple question here for all you actionscript wizzi's, I am loading a new .swf file into a new window using getURL, but when I do, the new .swf file is always opened in a non-maximized browswer window; my goal is to open it in a fully maximzed window..
Can anyone help please?
Thanks in advance.
View Replies !
View Related
New Window Spawning....ARRRGGHH
I'm working on a flash/html hybrid where the nav is flash and calls up html in a different frame ("body") on the page. All the buttons, targets, and urls are determined in actionscript and they all work great, except for one. This particular button spawns a new window and it SHOULDN'T. Code is exactly the same for all the buttons. All of them point to "body" but this one loves to spawn. Anybody have any ideas?
Thanks in advance!
View Replies !
View Related
Javascript Spawning Window? What?How?HELP
I'm sure this is simple but so am I!
I need to spawn a new page with a new movie in it 550x400 from a window that already contains another flash movie.
As far as I can gather from the tutorial I need to insert javascript:newwin() in Get URL and the modify the HTML in some way which is where I fail.
Problem 1. how can javascript:newwin() call the specific window I want?
Problem 2. how do I modify the HTML?
I must stress that I am almost bald because of this problem. This is also causing stress to my colleagues which will cause stress to their partners and then to their children and pets. Please help a nation reduce its stress levels and become a hero!
chin
View Replies !
View Related
[help]Spawning Window Component
Hi evryone!
I'm using this code:
Code:
myWindow = mx.managers.PopUpManager.createPopUp(_root, mx.containers.Window, true, {title:"Login", contentPath:"login_mc"});
To spawn a window component. The content is loaded inside the window, but for some reason, the text inside won't show. The input txt and the button DO load, but the txt above it doesn't. How come??
Greets,
Dauntless
View Replies !
View Related
Re: Spawning A New Brower Window
Ok, I had a hard time figuring out why this was not working for me and here is what I found:
In the tutorial where it says to paste the code for the button in the Fla file it looks like this-
Enter your details into the Generator (left) and then add them to your flash button in the following form:
on (release) {
getURL ("javascript:spawnWindow...");
}
Where the '...' is the rest of the code you generate. Enter your details into the Generator (left) and then add them to your flash button in the following form:
The problem I had was that it is not clear that you need an extra set of parentheses in this line of code to make it right. the full code should look something like this-
getURL("spawnWindow('myurl','myName','toolbar=no,l ocation=no,status=no,menubar=no,scrollbars=yes,res izable=yes,width=800,height=600')");
NOTE! the use of quote and double quote, as well as the use of parentheses.
It is a small point, but if you don't get it right, it doesn't work!
james
View Replies !
View Related
Spawning A Seperate Large Image Window From Thumbnail...
Hello all.
I'm having a problem that I hope someone can help. I have an "Images" link in my home page that when
clicked loads an external .swf into _level3.
Here's the problem:
The external movie contains several thumbnails. When I click on one I would like for a seperate
window to be spawned of the larger image. Pretty basic stuff. The action for the thumbnail is coded
as follows:
on (release) {
getURL("javascriptspawnWindow('Larger_Image.html', '','toolbar=no,location=no,status=no,menubar=no,sc rollbars=no,resizable=no,width=350,height=
200')");
}
I have an html page that contains the larger image as an .swf. The html page contains the appropriate code.
When I click the thumbnail nothing happens. I'm wondering the fact that the thumbnails are
contained in an external movie of the home page the reason it's not working. Any suggestions???
Thanks,
jartist
View Replies !
View Related
Maximized Study
The problem was in last year's Trinity programming contest problems, and I've been trying for a few hours to get it to work just right. I'm very close, but I know of one bug (which I'll let you try and find).
Here's the Java source:
Code:
import java.util.*;
import java.io.*;
public class Problem2 {
public static void main (String args[]) throws IOException {
Scanner scanner = new Scanner (new FileReader("problem2.txt"));
int numberOfCases = scanner.nextInt();
for (int i=0; i<numberOfCases; i++) {
scanner.nextLine();
int bagCapacity = scanner.nextInt();
int bagFull=0;
int numBooks = scanner.nextInt();
ArrayList<MyBook> books = new ArrayList<MyBook>(numBooks);
for (int j=0; j<numBooks; j++) {
books.add(new MyBook(scanner.next(), scanner.nextInt(), scanner.nextInt()));
}
Collections.sort(books);
ListIterator<MyBook> iterator = books.listIterator();
while (iterator.hasNext()) {
MyBook book = iterator.next();
if (book.weight+bagFull <= bagCapacity) {
bagFull+=book.weight;
} else {
iterator.remove();
}
}
System.out.println(MyBook.totalGradeValue(books));
}
}
}
class MyBook implements Comparable {
String name;
int weight;
int gradeValue;
double ratio;
public MyBook (String name, int weight, int gradeValue) {
this.name= name;
this.weight= weight;
this.gradeValue= gradeValue;
this.ratio = (double) gradeValue/weight;
}
public int compareTo (Object book) {
return ((int)((MyBook)book).ratio-(int)this.ratio);
}
public String toString () {
return this.name + " " + weight + " " +gradeValue;
}
public static int totalGradeValue (ArrayList<MyBook> books) {
int total = 0;
for (int i=0; i<books.size(); i++) {
total += (books.get(i)).gradeValue;
}
return total;
}
}
And here's the sample file loaded in (you need to save this as problem2.txt to make the above file read it).
Code:
2
10 3
History 7 30
Math 4 40
English 6 30
10 2
CliffNotes 5 99
OfficialText 8 1
It'll find the most it can bring home. The first line represents the number of cases following, and the first for each case represents the number of pounds available in your backpack, and the number of books to follow. Each book has its name, weight, and point value it's help your score.
It'll output:
Code:
70
99
For the 70 points you can get in the first set, and the 99 (with Cliffnotes) you can potentially get in the second set.
You have to get the most possible.
Try and find my bug, and see if you can solve it.
View Replies !
View Related
Standalone Player Maximized From Cd Inf
I am trying to make a catalog and distribute them on CD's
Using the flash Standalone player. The autorun.inf on my Cd
is:
[autorun]
OPEN=catalog.exe
but I want it to open in a maximized window or in full screen.
is this possible? please help me.... thanks.... Pinky_and_the_brain
View Replies !
View Related
When Maximized And Movie Is Loaded...
Hello all,
I have a Flash application of 140 .swfs. I am using a .exe projector file that calls all the other .swfs..
My issue is when the application is first started its at the document size of like 500x500 but if a user maximizes the window and then clicks a link to go to a different .swf, the new swf gets loaded but the window becomes un-maximized and gets shifted to the top left of the screen.
i want the window to stay maximized while a user is clicking around, any ideas on how to do this?
moi
View Replies !
View Related
Maximized Site Windows
< Hiya peoples and peeps. Usually flash sites will have a html page telling certain requirments you need. Such as 2advanced. Well, to enter that site, you have to press the 'enter' button. This brings up a new window which is the main flash site.
I was wondering...what html code do you have to put in ur html page for that button to open a MAXIMIZED window?
I want the main site to be maximized and unresizable.
The current code I have right now is :
center a href="http://www.geocities.com/snk821/whatevername
(I took off the < and the >'s cause I wanted to show the code)
What should I put in there to have the window maximized + unresizable as soon as it opens???
View Replies !
View Related
About Mc Spawning
I'm a little confused why there are multiple ways to spawn MC's. (duplicateMovieClip(), attachMovieClip(), createEmptyMovieClip())
I'm wondering if there is one a should use, specificaly, or in what situations I should use them. For example say I wanted:
OneMC.onKeyDown = function() {spawn(anotherMC, bla, bla)}
Also what exactly does depth mean. Also how would I make the spawned MC's have a property like:
onClipEvent(enterFrame){
_x++
}
I pretty much get these but I want to understand them better. Sorry If my posts are illegible but bear with me. Thanks in advance.
View Replies !
View Related
Help Spawning A Mc
hi everybody i need help
i have one ball mc
now when the ball mc is hit by a bullet mc i want the ball to spawn into two more smaller balls and when the smaller ball is hit the process will be repeated until the ball will be too small and therefore removed
it like asteroids you know
i tried but when i spawn the balls all of them get scaled when i only want to scale the ones hit by the bullets
please i would like a simple and nice tutorial on how to accomplish this
thanks again
View Replies !
View Related
How Do You Size The Flash Movie, So That It Can't Be Maximized?
Here is my question.
I want to know how to size the window for a flash movie. How do I make it so that the window cannot resize,
such as http://www.intellixmedia.com
And, how do I have it cover the browser? I know that full screen command makes it take over the whole screen, but how can I make it simply cover the browser, but still have the blue bar on top with the close button (x), and the minimize button (_)?
I would like to also have a flash movie fill the entire window area. I don't want any, html frame around it.
Could you give me the run down on all of these options? I'd truly appreciate it. I kind of need somebody to hold my hand through this.
Thanks.
View Replies !
View Related
Keeping Movie From Being Maximized - Help Needed
Like how can you keep any Flash MX movie, from being expanded to full-screen, I've noticed this quite often recently, aswell, with my movies, when you goto full-screen, my movies tend to lagg more when the vectors are enlargened. But anyways, Im quite sure most of you have experienced this problem, someone please help lol...
View Replies !
View Related
Objects Show Outside Stage When Maximized
Hello,
I wonder if someone could tell me why objects which is not on the stage show outside the document bounds when I maximize the movie. Its both in .swf and as an .exe
see example here : snowboarder
The snowboarder is appearing in the stage outside too soon. How can I avoid it?
View Replies !
View Related
Question About Maximized Browserwindow Animation
Hi, I got my flash movie maximized to full browser window. What I want to do though is have a simple animation thats starts as soon as the browserwindow has maximized to the users screen (right after the preloader). I just want the background of the full window to fade from grey to white. I tried to do this, but the bg-fill that I tween in flash only has the size of the stage, which is 1000 x 700, so beyond that, in my browser window its just white... I dont know how to make that animation full browser, so that it scales to the size of the users screen setting, while at the same time keeping the rest of the movie centered and at 100 % scale, no matter the screen setting. Can someone help me out with this, please?
thanks!
View Replies !
View Related
Maintain A Movie's Scaling Size When Maximized
I know this is probably any easy one but I'd like to know how...
How can I maintain a movie's size so that if i Publish my movie as an swf or exe and someone makes the movie full screen (maximized), the contents don't scale to the size of the screen, they just stay where they are and stay the same size as when the movie opened.
PS - I'm not trying to get rid of the title bar or or stop the user from maximizing the movie.
Thanks
-Foochuck
View Replies !
View Related
Maximized Popup In The Middle, Doen't Work
Hi!
im using this script:
<script type="text/javascript">
<!--
function popup(URL,width,height){
if (parseInt(navigator.appVersion) >= 3){
if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)<5){
var tools = new Packages.java.awt.Toolkit.getDefaultToolkit();
screen=tools.getScreenSize();
}
x = screen.width; y = screen.height;
}
window.open(URL,"sidan","top=" + parseInt(y/2-height/2-16-20) + ",left=" + parseInt(x/2-width/2-5) + ",x" + width + ",y" + height);
}
-->
</script>
to open a popup window wich is supposed to calculate the screen size and positon itself i the middle, i also wnat it to maximize and use the hole available screensize.
It works some times but not always, there's espessialy problems on widescreens (16:9) monitors like thoose on new notebooks!
can annyone help me?
om not that good at javascrip!
View Replies !
View Related
Maximized Flash Movie With External SWF-files
EDIT: For less blah blah and more focus on my actual question, check out the second post in this thread. Thanks!
------
Hello smart people,
I have a SWF-file with 2 objects in it:
1) A rectangle with a gradient colour that covers the entire movie, which is used as background for the site.
2) An empty MovieClip somewhere on top of the rectangle, used as a container to import external SWF files.
I want the rectangle with the gradient colour to cover the entire browser window, which I did by going to the Publish Settings - HTML and changing the dimensions to 100%. I also changed the setting "Scale" to "no border" to make sure my background (the rectangle with gradient colour) would be maximized as well.
The problem I'm having is that when the user makes his browser smaller, the whole main SWF and external SWF get smaller, and I want the external SWF to keep its dimensions. How do I fix this? The idea is a bit like www.monokai.nl, where the background fits every browser window from 1024x768 on, but all the components (buttons, logos, whatever) stay put.
Thanks in advance!
View Replies !
View Related
Bubble Spawning?
hello there
what is the simplest way to spawn a bubble ?
i mean everytime the bubble is hit by a bullet
i want the bubble to break in 2 or three smaller pieces
and if i hit it again each bubble will get smaller
until is so small tha it will be removed
i have tried something but it didnt quite worked
can anybody help me ?
View Replies !
View Related
Spawning New Windows
Ok, well I've followed the code in the tutorials and for some reason when I click on my button it still does not spawn an external window.
ActionScript
Quote:
on (release){
getURL ("javascript:window.open('http://www.energyottawa.com','newWin','width=400,height=3 00,left=0,top=0,toolbar=No,location=No,scrollbars= No,status=No,resizable=No,fullscreen=No');");
}
Anybody able to tell me what I'm missing here?
EDIT: I have popup blocked turned off... so it's not that.
View Replies !
View Related
Spawning Windows
hi all, im a noob.
ive setup a flash movie that posts to a webservice using geturl(url, 0, "POST"), which works fine, the annoying thing is the browser window that gets spawned everytime it gets posted.
is there an alternative to getURL or can i turn 'target' off?
cheers
0ad
View Replies !
View Related
Spawning Enemies?
I would like to spawn enemies and have them scroll across the screen, much like in the game Squares2.
http://www.albinoblacksheep.com/flash/squares2
What would be the best way to accomplish this via AS3?
View Replies !
View Related
Multiple Collisions And Spawning
I would like to have a MC that spawns (duplicateMovieClip) x number of instances of itself, names these instances unique names (like stat1, stat2, stat3, etc), and have all these instances run rampant within a boundary, always testing for collision. Upon collision, I would like to script them to bounce away from each other like billiard balls. I think I have the random movement, boundary, and basic hitTest ideas down, but i need help with the spawning, adding new names, and checking for multiple collisions constantly. Can someone please lend a hand? Many thanks.
View Replies !
View Related
Movie Clip Spawning
can anyone help me with adding a movie clip to the main timeline
im making or trying to make a game i have my enemy come on level one but how do i make him come 3,4,5 maybe more times on level 2 and so on all levels will be in one frame
i got my shop to work and i gotall other stuff to work i just need to make it randomly attach movie clip in one of 3 maybe 4 places
once these movie clips are on the stage then i want them to move to a position _X any _y hows it done?
please help
View Replies !
View Related
Movie Clip Spawning
can anyone help me with adding a movie clip to the main timeline
im making or trying to make a game i have my enemy come on level one but how do i make him come 3,4,5 maybe more times on level 2 and so on all levels will be in one frame
i got my shop to work and i got all other stuff to work i just need to make it randomly attach movie clip in one of 3 maybe 4 places
once these movie clips are on the stage then i want them to move to a position _X any _y hows it done?
please help
View Replies !
View Related
Random Spawning And Timer
I have 3 spawning positions for my monster.
I need to randomise such that my monster will spawn at either 1 of the 3 positions.
The monster will only stay there for 10 secs. After 10 secs it will spawn randomly.
I've already placed an empty movie clip at each of the spawning position.
I've did a timer, but i dont know to to reset for another respawn.
Can anyone roughly tell me how to randomise and attach my monster movie clip the empty movie clip ?
Thanks
View Replies !
View Related
Stop Spawning Windows
hi all, im a noob.
ive setup a flash movie that posts to a webservice using geturl(url, 0, "POST"), which works fine, the annoying thing is the browser window that gets spawned everytime it gets posted.
is there an alternative to getURL or can i turn 'target' off?
cheers
zeroad
View Replies !
View Related
Spawning Flash Player To Run My SWF?
Hi,
I am writing an application at the moment, and am wondering whether it is possible to be able to click on an swf link, but that it spawns up a flash player window to run the swf, and not try running it in internet explorer.
I know I can create a projector, but with most peoples firewalls, this wont allow the exe file to grab the xml files that I am using from my website.
So how can I make Flash player run my app outside of internet explorer, without having to download it first?
I hope this makes sense, please ask if you need more info.
I am using Flash 8, and Actionscript 2.0.
Many thanks,
AVThree.
View Replies !
View Related
Trouble Spawning A Popup From Flash
I have a flash file that needs to spawn a little popup and the conclusion of viewing the contents. I used the following code (frame action) to get it to work:
getURL("javascript:window.open('thankyou1.asp','th ankyou','width=300,height=200')");
This works fine in IE5 on my Mac but on a Windows box in IE5 the window that contains the Flash file is replaced with [object] and it's title is replaced with the javascript code above.
What am I doing wrong here?
Any help is greatly appreciated!
View Replies !
View Related
Flash Spawning Tool Tips
Is it possible for an .swf to call a tool tip similar to what the "alt='tool tip message'" parameter does in an anchor tag? If so, is there a way to modify the message pop-up time to be faster or slower when mousing over the target area? Any help is appreciated. Thanks.
View Replies !
View Related
[F5] Working On Spawning Enemies For A Game...
I am still working on that Asteroids game. I am having problems with the spawning; I was wondering if it was possible to make a duplicate of the enemy (Which is an asteroid) spawn every time your score hits a multiple of 2 (like 2, 4, 8, 16, 32, 64, etc.) I am not really sure how to do this, but I came here last week and asked and SilentWeed gave a bit of advice which helped me a bit. However, as of now an asteroid spawns on every even number.
Basically on 2, 4, 6, 8, 10, 12, etc an asteroid will spawn. It will appear and then erratically teleport all over the screen until it kills the player or you collect another point, at which point it moves normally. Then on the next even number, it teleports again. A third asteroid never spawns; its just this one duplicate porting all over the place on every even number. Being relatively new to ActionScript in general, and using AS1, it has been hard to find help with this. As of now, here is my code for the Asteroid, in case it helps. Please let me know if there is anything I am doing horribly wrong!
----------------------
//The following is a Function (named "go") that is defined here, to spawn the first asteroid. It should also run on the duplicate, just once//
onClipEvent (load) {
function go() {
this._x = random(800)+(_root.Ship+-(random(300(+50))));
this._x = random(800)+(_root.i+-(random(50)));
this._y = random(600)+(_root.Ship+-(random(300(+50))));
this._y = random(600)+(_root.i+-(random(50)));
this._rotation = random(360);
this._xscale = random(200)+100;
this._yscale = _xscale;
xSpeed = random(+2)+1;
ySpeed = random(-2)+1;
}
//the function "go" is actually run here//
go();
}
//here is what makes the asteroid move//
onClipEvent (enterFrame) {
this._x -= xSpeed;
this._y += ySpeed;
_x -= xSpeed;
_y += ySpeed;
this._rotation -= (3);
//here is the score definition. Its supposed to be "If the score is a multiple of 2, duplicate another instance of Asteroid." Something HERE is not right, though.//
if (_root.score%2 == 0 and _root.score != 0) {
duplicateMovieClip(this, "this"+a, a+300);
}
//makes it repeat on screen, if it goes off the border on the right it comes back on the left, etc. This is also on the ship//
if (_y<0) {
_y = 600;
}
if (_y>600) {
_y = 0;
}
if (_x<0) {
_x = 800;
}
if (_x>800) {
_x = 0;
}
//here is the collision detection, using "sentries", or blank MC's, to define the borders//
// for each sentry in this clip ("clip b") //
for (i in this.perim) {
// get the sentry's point on the stage//
this.perim.localToGlobal(p={x:this.perim[i]._x, y:this.perim[i]._y});
// see if it's touching o ("clip a")//
if (_root["Ship"].hitTest(p.x, p.y, true)) {
this.gotoAndStop(2);
_root["Ship"].gotoAndPlay(2);
}
}
}
View Replies !
View Related
Annoying Spawning MovieClip Problem
I've been working on fixing this all day and can't seem to figure out what's going wrong and would appreciate some help.
On the main timeline I've placed a container MovieClip. It's empty but for a few lines of code on the first keyframe that places an instance of another symbol - a basic title screen layout - into the container.
(The reason I'm using a container MovieClip was to work around a problem I was having this morning whereby Flash would crash when I tried to place an instance of a MovieClip onto the stage using code when the code was on the main timeline.)
There is code on the titleScreen class file which adds another MovieClip and removes the title screen, essentially moving from one screen to the other; from titleScreen to gameStage.
I'd hoped to have some code in the gameStage class whereby a player character (at this stage a small black square) would be placed onto the gameStage using addChild, as I'd done before with the previous titleScreen. When I un-comment this code and preview my swf an unexpected result occurs. When the click is made to remove titleScreen and add gameStage, gameStage is brought in correctly, but a new instance of titleScreen is also added.
TitleScreen.as
ActionScript Code:
package {
public class TitleScreen extends Main {
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.events.*;
import flash.ui.Keyboard;
public function TitleScreen() {
addEventListener(MouseEvent.MOUSE_DOWN, titleScreenMouseDown);
}
public function titleScreenMouseDown(evt:Event):void {
if (evt.target == titleScreenButton_btn) {
var gameStage_mc:MovieClip = new GameStage();
MovieClip(parent).addChild(gameStage_mc);
removeEventListener(MouseEvent.MOUSE_DOWN, titleScreenMouseDown);
MovieClip(parent).removeChild(this);
}
}
}
}
GameStage.as
ActionScript Code:
package {
public class GameStage extends Main {
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.events.*;
import flash.ui.Keyboard;
public function GameStage() {
addEventListener(Event.ENTER_FRAME, gameStageEnterFrame);
}
public function gameStageEnterFrame(evt:Event):void {
// These lines cause difficulty!
//
// var player_mc:MovieClip = new Player();
// addChild(player_mc);
}
}
}
Main.as (The Document Class)
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.events.*;
import flash.ui.Keyboard;
// import flash.display.Stage;
public class Main extends MovieClip {
public function Main() {
addEventListener(Event.ENTER_FRAME, onFrameEnterListener);
}
// ************ Listeners ***************
public function onFrameEnterListener(evt:Event):void {
}
// ************ Angle/Math Functions ***************
public function rotationToAngle(objectRotation: Number): Number {
var newAngle: Number = 0;
newAngle = objectRotation + 180;
if (newAngle > 360) {
newAngle = newAngle - 360;
}
return newAngle;
}
public function getXDistToMouse(): Number {
var xdist: Number;
xdist = Math.abs(parent.mouseX- x);
return xdist;
}
public function getYDistToMouse(): Number {
var ydist: Number;
ydist = Math.abs(parent.mouseY - y);
return ydist;
}
public function thetaToMouse(): Number{ // Calculate the angle between the mouse and a point, and return the appropriate theta value
var xdist: Number;
var ydist: Number;
var angle: Number;
var theta: Number;
xdist = getXDistToMouse();
ydist = getYDistToMouse();
angle = Math.atan(ydist/xdist);
if(parent.mouseX >= x && parent.mouseY <= y){
theta = angle;
}else if(parent.mouseX < x && parent.mouseY <= y){
theta = Math.PI - angle;
}else if(parent.mouseX < x && parent.mouseY > y){
theta = Math.PI + angle;
}else {
theta = (2 * Math.PI) - angle;
}
return theta;
}
public function rotationToMouse() :Number {
var angle: Number; angle = 0;
angle = thetaToMouse();
angle = convertAngleToRotation(angle);
return angle;
}
public function convertAngleToRotation(angle: Number): Number {
angle = -((180*angle) / Math.PI);
angle = angle + 90;
return angle;
}
}
}
Player.as - Probably fairly irrelevant though I've included it just in case the cause is here.
ActionScript Code:
package {
public class Player extends Main {
import flash.display.MovieClip;
import flash.events.*;
import flash.ui.Keyboard;
// keyboard capturing
static const RIGHTKEY = 39;
static const LEFTKEY = 37;
static const UPKEY = 38;
static const DOWNKEY = 40;
public var keyPressedRight: Boolean;
public var keyPressedLeft: Boolean;
public var keyPressedUp: Boolean;
public var keyPressedDown: Boolean;
public var keyNum:int;
// temporary rendering values
public var dx: Number = x;
public var dy: Number = y;
public var drotation: Number = rotation;
// Gameeplay variables
public var rateOfRotation: uint = 3;
public var rateOfMovement: uint = 3;
public function Player() {
this.addEventListener(Event.ENTER_FRAME, playerEnterFrame);
}
public function playerInit() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressedListener);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUpListener);
}
public function playerMoveForward() {
var xdist: Number;
var ydist: Number;
xdist = rateOfMovement*(Math.sin(2.0*Math.PI*(rotation)/360.0));
ydist = rateOfMovement*(Math.cos(2.0*Math.PI*(rotation)/360.0));
dx = dx + xdist;
dy = dy - ydist;
}
public function playerMoveBackward() {
var xdist: Number;
var ydist: Number;
xdist = rateOfMovement*(Math.sin(2.0*Math.PI*(rotation)/360.0));
ydist = rateOfMovement*(Math.cos(2.0*Math.PI*(rotation)/360.0));
dx = dx - xdist;
dy = dy + ydist;
}
public function playerEnterFrame(evt:Event):void {
getKeys();
render();
}
public function onKeyPressedListener(evt:KeyboardEvent):void {
switch (evt.keyCode) {
case LEFTKEY:
keyPressedLeft = true;
break;
case RIGHTKEY:
keyPressedRight = true;
break;
case UPKEY:
keyPressedUp = true;
break;
case DOWNKEY:
keyPressedDown = true;
break;
default:
trace(evt.keyCode);
}
}
public function onKeyUpListener(evt:KeyboardEvent):void {
switch (evt.keyCode) {
case LEFTKEY:
keyPressedLeft = false;
break;
case RIGHTKEY:
keyPressedRight = false;
break;
case UPKEY:
keyPressedUp = false;
break;
case DOWNKEY:
keyPressedDown = false;
break;
default:
trace(evt.keyCode);
}
}
public function getKeys() {
if (keyPressedRight) {
drotation = drotation + rateOfRotation;
} else if (keyPressedLeft) {
drotation = drotation - rateOfRotation;
}
if (keyPressedUp) {
playerMoveForward();
} else if (keyPressedDown) {
playerMoveBackward(); }
}
public function render() {
x = dx;
y = dy;
rotation = drotation;
}
}
}
Also, here's the code that sits on frame 1 of the Container MovieClip:
ActionScript Code:
var titleScreenSymbol_mc:MovieClip = new TitleScreen();
addChild(titleScreenSymbol_mc);
I can't understand how with the addition of two seemingly innocuous lines of code I now have multiple spawning title screens. Any help would be appreciated, and I've attached the source files to help out.
View Replies !
View Related
AS Help: Spawning MC At Runtime In A Grid Shape
Here is what I am trying to do. I need to write out a script that will spawn a MC (which is just a circle) in a grid that spans 100 circles across and 100 down. They need to be evenly spaced out without the circles touching. I will also need to add a keypress event which will change the color of each subsequent circle in turn. I am doing this for a project where we record the eye and head movements of a subject as they look at each circle on the screen.
I am thinking that an array might do it the fastest, but I know very little of the workings of arrays. i do know something of duplicating MC's, but the way I know, I would have to hand code all 10000 circles and I don't really want to do that.
If someone comes up with an example, I am using Flash MX 2004 Pro. I will not have access to v8 until after this stage of the project (total drag).
Thank you all!
View Replies !
View Related
Close.window Script In Flash Button Quits My Browser Window Or Crashes System
Can somebody please help me?
I have a javascript attached to a button in a .swf file to close the browser window it is in.
The code which was given to me yesterday by senocular is
on(press){
getURL("javascript:window.close()")
}
__
however if you try it IE will unexpectedly quit or bomb my computer.
I tried it in Netscape and it didn't crash.
You can refer to my site http://www.valdesdesign.com
after intro go to print button and then to editorial button.
Editorial opens new window with editorial.swf inside. Click on top right button to close window and see what happens.
Is there something I'm doing wrong? Please help me.
Thanks
View Replies !
View Related
Link In Pop-up Window (flash File) Target=parent Window
I have a flash demo that is opened from our web site and spawns a new window. At the end of the demo is a link that directs the user to "get more information." I would like this link to open the "more info" page in the PARENT window rather than the spawned window. Currently I have my Flash link coded with:
on (release) {
getURL ("http://www.hiddenmind.com/materials.html", _parent);
}
This is not working. Do I need to add some code to the parent window and/or the HTML page where the Flash file is embedded?
Thanks for your help! I can't seem to find the solution
View Replies !
View Related
AS: Close Current Window And Open Link In Father Window ?
Please, guys, can anyone lead my hand in this?
I have produced a flash movie. the wholw are is an invisible button which
should close the animation and in father window open a link.
The flash movie pops up automatically when page is loaded. I used this:
on (press) {
getURL("javascript:self.close();window.opener.loca tion.href = 'http://www.unibanka.sk/servlet/com.elline.pb.Page?page=alfa_ts'");
}
... but am not sure if this would work exactly how I want it.
Thanx
View Replies !
View Related
|