ActionScript 2.0 :: Use A Button On Stage To Load A Swf?
Mar 14, 2006
I am trying to use a button on stage to load a swf and then on subsequent presses, advance to next frame.The movie loads, but on subsequent presses, it either reloads the movie, or replays the 1st frame.So I believe the 1st Two lines work, but the rest?
I have been trying to pick up more as3 lately, also have been converting some of my sites from as2 to as3. In as2 I could create 3 menu buttons and save them in a mc- lets call it menu_mc. This menu_mc sits on my main stage. I have also placed a mc on stage to hold anything that I load. Lets call it holder_mc. So I figured out how to get my email button to work using this:
email_mc.addEventListener(MouseEvent.CLICK, mailto); function mailto(event:MouseEvent):void { var email:URLRequest = new URLRequest("mailto:myemail@mail.com"); navigateToURL(email, "_blank"); }
That's fine. What I can't for the life of me figure out is understanding how to click on one of my menu buttons and load a swf into my holder_mc on stage. In as2 I could use this code on a button :
on (release) { //load Movie Behavior if(this.my_holder == Number(this.my_holder)){
I have been trying to pick up more as3 lately, also have been converting some of my sites from as2 to as3.
In as2 I could create 3 menu buttons and save them in a mc- lets call it menu_mc. This menu_mc sits on my main stage. I have also placed a mc on stage to hold anything that I load. Lets call it holder_mc. So I figured out how to get my email button to work using this:
email_mc.addEventListener(MouseEvent.CLICK, mailto); function mailto(event:MouseEvent):void { var email:URLRequest = new URLRequest("mailto:myemail@mail.com");
I have a movie with two squares. Depending on which button is pressed, the demmensions of the both squares change for which I used the following function:
The code for the other buttons is the same but with other arguments. Now do I also need to integrate a loadMovie in the different button actions, to load the different ext.swf's in a container on the stage, but I only want the swf's to load after the callback is finished (when the squares qre not moving any more) How does the loadMovie should look like?
I am trying to load a swf into a holder movie clip from the child movieclip.It's parent has a holder that i want to load a swf into.I am navigating from within a child clip.It would be nice to have the swfs load from an external xml file but it isn't mandatory.
I have created a website which loads external swfs as pages onto the main stage on the click of a button. I am using Flash CS3 and Actionscript 3.0. Here is my code:
I have 4 movies that need to be loaded in sequence. The first movie loads the second one, the second one loads the third, then the third one loads the fourth. What I can't figure out is how to make sure there's only one movie loaded at any time. I've tried removeChildAt(0) and other methods. What's the best way to load a movie to the stage and wipe out what was on the stage?
I'm making a mockup for a client and I need to Load the .swf with the exact stage size so the graphic elements do not float outside the loaded movies stage area. [URL]Basic load code I'm using...
I have event listeners for a MouseEvent.CLICK and so when thelistener triggers the function I want it to change the "box" symbolon the stage to the corresponding symbol in the library for the
I created a button with some roll over effects added some load movie action to load external movie.swf file, everything works perfect except I need about 12 same buttons but with different loadMovie command I mean to load different swf files. so what I did to make it fast I copied the first button and pasted it 12 times so I made 12 nice buttons, but the problem I have is that when I change button 2 load movie settings it automatically changes every button, so I am a little frustrated,
I have successfully dynamically loaded Jpegs into my flash document(using PHP), but then I have another small problem.When I dynamically load the image (example: image_icon_bluesky.jpg) I then need to tell the MC that is holding the loaded image that it needs to do this...
on (release) { _root.image_bluesky.alpha = 100; }
SO basically every time a new image is loaded in my sort of "loop" script. I need to tell the image that it needs to put specific code onto the MC using specific "image" details for that specific image.
I hope this is clear. Basically what I'm trying to do.On my flash stage I already have MC's that have their alpha properties set to "0". Lets say there are 3 images. One MC is called Blue, other is called Red and the last one is called Yellow.Now using AS + PHP I have dynamically loaded 3 Jpeg's .
[Code]...
and so on for each image....I have tried to explain this as well as I possibly can. I just wanna know if this is possible or if there is a simple way of doing it
on the main stage i have pretty much a blank canvas with a set border. I am trying to load in external SWF onto the main stage. I am using this:
KeyListener = new Object(); KeyListener.onKeyDown = function() { if (Key.getAscii() == 97) {
[Code]....
THe problem i have is that the score disappears when either of the 2 SWF files are loaded. Its as if the SWF files are loaded and everything else on the timeline is unloaded. Not sure how i get around this?
How can I load multiple conditional MC's in to my stage?What I am trying to do is use nams stored in an array that corrispond to MC's and have it place the MC's on the stage in a way similar to a gallery. However the array is generated by clicking a selection of buttons so the buttons that aren't clicked are not added to the array hence IF statements are used when looking at the array. [code]...
I have a picture gallery and I'm trying to figure out how to bring on the next picture by dragging the one currenly on the screen off of the screen to the left. Im not looking for the code exactly but just an explaination of the sequence of code or some kind of quazy code so I get the idea.
If you want me to post my gallery code I can do that. its just a bit long. Currently it works with using "next" and "back" btns I just have not been able to change it to work with startDrag etc.
I have several buttons which when clicked should load an external swf to the stage. This is an example of one of my events
[Code].....
Firstly, should I be doing this in every buttons event, or is there a more economical way of doing it? Like will it allow me to make the loader global, and reuse the same loader with each event? Secondly, if I have it like this, and I click a button, an swf will load onto the screen. If I then click another button, another swf will load. Will this second swf sit on top of the first swf? In other words, do I need to check if any other swf's in on the screen before placing a new one, and if there are, should I remove them?
i try create a code, which can load to stage Movie Clips(which included pages of my website) I've created code which load Movie Clips on stage,Listing of this code:
ActionScript Code: var currentPage:MovieClip = index_mc; var indexPage: pageIndex =new pageIndex();
- I have a player.as with code to control playback of videos - I have a skin.as with code to control and organise skin components - The skin.as file loads a "shared library" (quotes as I don't think I'm doing this correctly) which is essentially a swf file with nothing on the stage. It's library contains things like: play buttons, scrub bars etc. all these assets have associated, linked class files to add functionality.
1. Load the containing swfs 2. Create new instances of the linked classes 3. Add them to the stage to be used.
However, there is an issue preventing me from using the linked assets in this way - I can't use the linked assets unless- - I add something to the stage of the "shared library" swf - I then do something like skinSwf.addChild(libraryFile) What I want to do is just use the linked assets, not have to deal with any other parts of the "shared library" file.
I would really like a class that i can use to load all my movieclips from.I have 100's of external swfs - and i want to load them to stage from one class - as they are requested.I did manage to do it one way, to get access to the stage i did this:
Actionscript Code: private var _stage:Stage;
and in the constructor code, just did:[code]...........
how to actually load the swfs, what i'm really looking for is a way to use addChild to the stage from within my class.
I'm trying to work out the details in my head about some of these objects. A loader, and a movieClip. Is the loader the default object to use to load images/movies onto the stage (Actionscript 3)? The movieclip is more of an actionscript 2 object? (thought I read that somewhere).
If not what is the difference between these two objects and why would you use one and not the other.(you don't need to go onto too much detail) I'm learning AS3 but there is some AS 2 scripts (trying to convert to 3) that are used in our projects, so I've had to bounce back and forth with how I code.
I have made many small swf files for each section of my website. The problem is now I want to club them all together to avoid breaks and showing of the loader at inappropriate moments, I know that was poor planning on my part. I want to know I can place an external swf onto the stage, so that it gets loaded with the main swf. As in, I don't want to call a loadMovie or loadClip
I commented my code below to reflect what I am attempting to do here. Flash is throwing me a 1084 error at the moment but I cannot spot my issue. I expect that it is something to do with the this['circle'+i] statement.
var boxOne = new box(); stage.addChild(boxOne); boxOne.x = stage.stageWidth/2;
Actually i have to load images into stage from any server,so tried using crossdomain.xml from my server root.though it throughs error
SecurityError: Error #2122: Security sandbox violation: Loader.content: http://sss/Player.swf cannot access http://ffff/images/logo-bg.jpg. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.at flash.display::Loader/get content()at SS4UPlayer_fla::MainTimeline/ss4uLogoCompleteHandler().
I am preparing a photo gallery containing over 100 HD images, and I don't want any site visitor to wait the whole gallery to load. So I made them loaded from a folder with the help of an xmlList file. With GoForward and GoBackward buttons, I made every picture to load when requested with "addChild" command after removing the previous one. But if the next image is too big the visitor still have to wait the image to load, and another problem is if the visitor makes a few forward or backward moves he/she still have to wait for the very same image to load which is shown moments ago because the image have been unloaded.
Is there a way to load all the external images into library but make them wait in the swf cache until the associated button is clicked. so this way no image will be load twice nor the visitor should have wait.
I'm developing a flash lite app in as 2.0. loading a movieclip on to the stage from the library. The name of the mc is Objects and I have exported it for actionscript in the linkage. I learnt as 3.0 initially. That is why finding difficult in going to as 2.0
This is how i did it in as 3.0
Code: var obj:MovieClip=new Objects(); addChild(obj);
how to import them in to the mc's on the main stage: they are named mc1, mc2 to mc6.Also, because the images will vary in width and height, I need to align them to the center horizontally, and aligned at the bottom of the holding mc.