ActionScript 3.0 :: Switching From AS2 To AS3
Nov 17, 2009How can I write this snippet of code for a button in AS3?I'm having a hard time completing this.Here is my AS2 code.It is attached to a button.[code]
View 2 RepliesHow can I write this snippet of code for a button in AS3?I'm having a hard time completing this.Here is my AS2 code.It is attached to a button.[code]
View 2 Repliesi made a character that has 5 frames:
1st nothing
2nd axe
3rd spear
4th sword
5th bow
i am trying to make it so the weapons will switch when i press the a,b,c,d,e button on the keyboard( i will figure out the actual button l8r) i have made a mc clip button to make it switch which works but i cant figure out how to do it from the key board
[Code]...
i have an rtmp folder with videos,I am trying to do a seamless change to next video using nestsream play2 method.have tried using the fast switching of NetStreamPlayTransitions. SWITCH like below.[code]The problem is the switching is not happening.offset=-1 is supposed to be fast switching. The idea is to make a seamless transition to the next video.if we dont use any transition method or use opts.transition = NetStreamPlayTransitions.RESET;its the same as not using any. It just switches normally.RTMP is supposed to provide a relatively faster transition, i am looking for a seamless option .
View 1 RepliesI am using the following line of code in my Flash movie: navigateToURL(request,"_blank");However, when I am using Internet Explorer 7 (with tabbed browsing enabled), and this code is called to open a link, the link is opened in a new tab, but IE7 does not switch you to view that tab as you would expect!When I open a link in a normal web page in IE7 (and the link opens in a new tab because _blank was specified in the HTML code for that link), IE7 will switch you to that new tab to see the web page you just opened, so why does it not happen when using Flash?I know that within the settings for IE7, there is a setting that you can tick that says, Always switch to new tabs when they are created, and this solves the problem. However, many web site visitors will not have this ticked.How can I make sure that when a user opens a link in a new tab from my Flash movie, IE7 switches to that tab?I am using ActionScript 3.0 and Flash CS4.
View 1 RepliesLet me preface this post by saying I have been studying actionscript 3 for 2 months now and I am now at a point where I am looking into how experienced developers code their projects and what tools they are using. Repeatedly, I come across a post or a blog entry where a developer says:
[Code]...
Now here comes my confusion/question(s). When a developer says something like that, are they saying that they ONLY use FDT to create their projects? If so then how are they going about doing it without the use of the Flash IDE? Do they just keep creating external .as classes and then link them all together or what?
In my 2 months of studying, I really feel like I have learned a lot, but I cannot seem to wrap my head around this. I want to break away from the Flash IDE (if at all possible) so that I can go deeper to the code.
I'm making a website for my business. I want this site to run similar to an OS UI. The first issue I've run into is swapping between "window" MC depths. I'm not quite sure if its just that I need to add a mathematical variable to each one every time it is clicked or how to getDepth of the highest "window" MC in order to put the desired "window" MC above it.
You can download the .fla file <a href="www.dpr.150m.com/images/index.fla">here</a>.
If I have a prompt window where I am asking the user for some input, is there some way I can prevent them from switching window focus to the other windows in my application? (switching to other applications is fine) I'd actually have preferred if the window didn't appear in the taskbar at all, but utility windows look awful and I'm using system chrome so lightweight is out.
View 5 RepliesI just try to work on a document and need to draw something with my graphic tablet, but everytime I switch from mouse to graphic tablet, Flash crashes immediately.Is there any way to make it work WITH the tablet?! I remeber it worked once, but now it's pretty f**ed up.
View 1 RepliesNeed to design a flash video player which can run multiple angles of video at the same time. The primary video will run at full size, and the other angles will run at a much smaller sample size at the bottom of the video. User will then be able to select whichever angle of video he likes and upon clicking the smaller video it will become full screen/mainplayer shell. The video which was previously full screen will then take its place among the other smaller videos.
View 2 RepliesI've been having a problem with an interactive Flash CS5 project: when I navigate between frames using gotoAndStop(1); the program experiences the following error: Error #1009: Cannot access a property or method of a null object reference. I think this is because the first frame that the function goes to has none of the objects that have event listeners in frame 2. All I'm hoping to do is go back to the first frame. Would it be best to put everything on one frame and work from there? That seems unneccessarily complicated.
View 4 RepliesI've coded a little game, but now I realized that I should include all the actions to frame on layer called "actions". This far I've written my code to movieclip.transforming this to frame?
onClipEvent (load) {
yspeed = 0;
lastx = 0;
gravity = 0.2;
[code]....
I've done a lot of Flash development and have been meaning to try out canvas for a while, but after browsing through some tutorials, I can't understand how this is supposed to replace Flash.
Note: I ask a lot of questions down here. I don't really expect them all to be answered. What I'm really looking for is some basic guidance about how I should be thinking while developing on <canvas>.
From the spec, it looks like <canvas> is really more analogous to the Graphics class in Flash, which one would use something like this:
class ColoredCircle extends Sprite {
private var _color:uint=0x0;
public function ColoredCircle(color:uint) {
[Code].....
Should I be treating <canvas> like a Sprite? Marking everything as position:relative should allow me to basically duplicate display list-type behavior (I don't believe that you can nest <canvas> elements, but you could probably do so by throwing in a bunch of <div>s). However, I use a lot of Sprites in my projects. That's going to be a metric crap-ton of tiny canvas elements. Also, how do you handle mouse events in <canvas>? Do they trigger if someone clicks on a transparent part of the canvas's box model (bad)? If I have a canvas with two circles in it and I need to know which one gets clicked on, do I have to do bounds-math with the mouse position?
Suppose I have one combo box and I am switching its data provider from oldDataProvider to newDataProvider with ActionScript. Both data providers are ArrayCollections. Then, when a change occurs in the oldDataProvider ArrayCollection, it affects the combo box, although it is not its data provider anymore. Specifically, when removing an item from oldDataProvider (in the range of the newDataProvider values), it decreases the selectedIndex value of the combo box by one, changing the selected item.
View 1 RepliesIt sounds super easy, but I don't know where to start. What I want is to have some buttons on the stage, and a mc to load some content related to the buttons. the content is in the library and is exported for actionscript. I want the content to fade in and out when you click a new button without leaving the page. Is this going to be an if then statement, switch statement, for loop?
View 1 RepliesI'm using Flash CS5 Components in an App. I want to allow the user to tab around.
I want a modal popup window to show and for the tab loop to switch from the main UI to the modal window UI.
Using FocusMangers should allow me to do this but I'm struggling to get anything working. The tabbing continues back out to the main UI instead of sticking in the window.
I want to be able to press a key once and have it stay on a movie clip (which it does) and then press it again to return to the existing movie clip
View 1 RepliesWhen the character touches the escape, the level loads of course but neither character or the exit shows up.
ActionScript Code:
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
[code]....
I'm importing external SWF's into the main file/stage.These SWF's contain an embedded Youtube video.The code Youtube player:
ActionScript Code:
// The player SWF file on youtube.com needs to communicate with your host
// SWF file. Your code must call Security.allowDomain() to allow this
// communication.
[cod]....
when I click a second button to import a next SWF, the current SWF disappaers but I can still hear the video playing. When I start the newly imported SWF, I hear the 'removed' SWF playing + at the same time I see & hear the new imported one?It does work properly when I first stop/pause the current SWF, before importing the next one ... but this process should be automatic.
I am working on a side scroller. The point is to collect 10 coins, and on that event, a door will open. I need to make it so when the character HitTest the door, while dooropen = 1 to go to the scene 2 and play it. Here is the code I have.
onClipEvent(load){
var dooropen: Number = 0;
}
onClipEvent(enterFrame){
[Code]....
i have an rtmp folder with videos,I am trying to do a seamless change to next video using nestsream play2 method. have tried using the fast switching of NetStreamPlayTransitions.SWITCH like below.
ActionScript Code:
private var FName:Array = ["1av.flv","2av.flv","3av.flv","4av.flv","5av.flv"];
private var opts:NetStreamPlayOptions = new NetStreamPlayOptions();
// on init of net connection
[code]....
The problem is the switching is not happening.offset=-1 is supposed to be fast switching. make a seamless transition to the next video.
if we dont use any transition method or use
ActionScript Code:
opts.transition = NetStreamPlayTransitions.RESET;
its the same as not using any. It just switches normally.
I've created a function that plays a number of loops and transitions in a specific order which is this: Loop1 > Trans1 > Loop2 > Trans2 > Loop3 > Trans3 > Loop3..Now, the last loop (loop3) is supposed to play infinite after trans3 has finished, but that doesn't work. (This is the goLoop function )So, basically, what I want to do is to have a button that switches the currently playing loop to the next one, and between them should the transition play automatically.
View 2 RepliesI've coded a little game, but now I realized that I should include all the actions to frame on layer called "actions". This far I've written my code to movieclip.
onClipEvent (load) {
yspeed = 0;
lastx = 0;
[code].....
I have 2 movie clip avi1 and avi2 i am using movie controls for them....like start stop pay..etc. now iam use another button whitch switches between these 2 avis.. how do i do that....also i want the controls to be same for both the movie and Working...
View 5 RepliesI'm currently making myself a new portfolio, mainly because I want to start learning some more advanced actionscript skills. I'm trying to setup my site so it runs completely off xml data. Firstly I have an xml menu loading into "menu.swf" and also a xml document with loading into a "project.swf"... Now instead of making a different swf for each project I thought it would be better to have one swf. This would mean loading in a different xml document into the projects window. Where I'm stuck is i'm unable to load a new xml into projects.swf. This is a button I'm generating from xml in menu.swf
[Code]...
i know how to program in vb.net, and have little problems switching to action script. the only problem im having is that i dont know where to type my code. in visual basic there were events that you would type into. does any one who knows Vb know what im talking about? i get the whole convert to symbol stuff just not where im supposed to type
View 3 RepliesI am working on a small flash website site and its almost done.Now the only thing for I am struggling for a separate url for every page. the challenge is I have the complete website in one swf and i am switching between the pages using new keyframes with labels.
I don't know how can create a separate url for every page. Can anyone share some tutorials or suggestions?
I'm working on a gallery. In the "Picture.as" class I load the picture and there is also a function with an animation to make the picture disappear. In the main class the pictures are put to stage by putting instances of the Picture class.All I need to do now is to adress the function in the according Picture instance. It works fine as long as I use the direct link, but when I use a variable it does not work anymore.Here's my code:
Code:
public class.... // just for the example
{
[code]....
It's been a while since I posted anything here, but anyway:
I've created a function that plays a number of loops and transitions in a specific order which is this: Loop1 > Trans1 > Loop2 > Trans2 > Loop3 > Trans3 > Loop3
Now, the last loop (loop3) is supposed to play infinite after trans3 has finished, but that doesn't work. (This is the goLoop function )
So, basically, what I want to do is to have a button that switches the currently playing loop to the next one, and between them should the transition play automatically.
I am using Flash MX 2004, aka Flash 7, and Actionscript 1. What I have is a movie clip that plays on frame one. Its a variation of loading screen. What I want to do is make it so that when the movie clip is on its last frame (frame 100), then it switches to frame 2. NOT frame 2 of the movie clip, but frame 2 of the overall project.
Code:
if (_root.loader._currentframe == 100) {
_root.gotoAndPlay(2);
}
(movie clip is called loader)
I have also tried naming frame 2 "finishedLoading" and just "2", but it still will not go.What happens is, when the movie clip animation is finished and on frame 100, it just sits there. I had to put a stop(); in frame 1 so that the animation could play, but it stays stopped. This was all done after I tried the logical approach where inside of the movie clip on frame 100 of the movie clip, I made an "Actions" layer and on frame 100 keyframe, I put:
Code:
gotoAndPlay(2);
I also tried
Code:
gotoAndPlay("finishedLoading");
and
Code:
gotoAndPlay("2");
I have even resorted to the last resort. I put tried to make a variable so that when the movie clip is on frame 100, that "var finishedLoading" would be set to true, and then:
Code:
if (finishedLoading == true) {
//
}
Inside of the comment would be gotoAndPlay(x);
I've noticed since the last few version of flash player that when your main view isn't focused on the flash game, it tends to mess the game up.How do I make it so the game automatically pauses when I switch to a new window or lose focus.
View 6 Replies