Actionscript 2.0 :: _lockroot Not Working Properly On Sounds?
Oct 12, 2010
i took inspiration from the tutorial for the mp3 player (some code will surely look familiar to some of you) to build up a music player that plays songs from a defined array, and made it fully working. Somehow proud of it, i consider myself intermediate in ASing Now, the problem is that then i load this music player into a main.swf there's no sound."hey you surely forgot to add _lockroot". Ehm, no. Actually i did several tries with it. This is why i'm here
Architecture:
- one Main Movieclip (mainmovie.swf);
- one Music player (musicplayer.swf);
Music player is loaded into Main Movieclip through a loadMovie call; absolute path to target would be _root.mp3cont (in Main Movieclip obviously); the loadMovie call happens on the AS layer in the _root of Main Movieclip; about the Music player:
- there's a movieclip on the main timeline that acts as container. Name is "sound_clips";
- the music player is INSIDE the mc "sound_clips";
- music player works with attachSound;
This is the code on the AS layer:
Code: Select allimport gs.*;
import gs.easing.*;
OverwriteManager.init
[code]....
1. I tried to insert Code: Select allthis._lockroot = true; on the FIRST FRAME of the Music player root, that has, as said before, a movieclip named "sound_clips" that contains actually the music player (AS + slider AS); - Didn't work.
2. I tried to insert Code: Select allmp3cont._lockroot = true; on the FIRST FRAME of the Main Movieclip root, where i have mp3cont as container mc for that swf that is load through a loadMovie("musicplayer.swf", "mp3cont"); call. Didn't work either.
3. I created a new file (a blank .fla) with just the loadMovie call and the mp3cont._lockroot = true; (obviously on separated layers) method to see if it actually worked. Didn't work.
4. I removed the container in the music player and put all the stuff on the _root, so the code for both the attachSound and the volume slider are on _root. Placed a big phat this._lockroot = true; but didn't work. Also didn't work with the following ones (the music player IS STILL working):
- this.s._lockroot = true; (put AFTER after the definition of the sound object obviously, as s is not yet defined)
- this._parent._lockroot = true;
5. Without the above mentioned container i tried placing it in the swf that actually loads it, and even tried MovieClipLoader and loadMovie. This is the last attempt:
Code: Select allthis.createEmptyMovieClip("sound", this.getNextHighestDepth());
sound._lockroot = true;
sound.loadMovie("musicplayer.swf");
View 3 Replies
Similar Posts:
Sep 5, 2011
I am wondering if somebody here knows how to achieve this:I need to lock the root of an external swf (loaded using behaviors on a button). The reason I need to do this is that I need the sub swf to stop looking for its assets in the main website root, and find them right beside itself in the same folder. I do not have the actual fla of the sub swf, hence the problem.
View 3 Replies
Apr 6, 2009
I have an old swf, perhaps created prior to player 7.When I load this swf into a newly created swf it no longer works as expected. I suspect that it is because it was created with _root used to scope variables.I applied _lockroot to the container MC that loads the old swf but this does no good. I suspect this is because the old swf was created prior to player 7 and _lockroot does not work with these.Now to the question. Is there anything I can do to get a swf created prior to player 7 to work with _lockroot?
View 3 Replies
Jun 17, 2009
You can only code in the "Main Timeline" or root. But how does that work with loaded SWFs? Like Is there a Stage for each SWF, or only one for everything? Also, how does _lockroot come into play to affect debugging?
View 0 Replies
Nov 17, 2011
Are there any audio management libraries for ActionScript 3? The more tailored they are for game development the better.I'm finding it hard to understand and work with multiple channels, which is making a lot of my audio sound screwy and cancel each other out, etc. I've been working on an RPG that can at a given time have quite a number of sounds playing such as environmental noise (like opening doors, thunder, rain, etc), walking enemies, inventory sounds (for events like dropping an item into your inventory), passive spell-casting sounds, voice clips, weapon swinging etc. Alternatively, if there are any good resources that explain how to use multiple sound channels strategically.
View 1 Replies
Apr 2, 2004
i tried following the duplicate mc tutorial, however the part on putting the code in a frame to get it to duplicate on load doesn't seem to work for me
here's my code in the frame:
stop();
amount = 5;
while(amount>0) {
[Code]....
apparently the clip only gets duplicated once where's the problem?
View 5 Replies
Jun 25, 2009
I'm trying to do in this case is populate a List UIComponent that I created with information that I get back from the PHP file. For some reason the loader.addEventListener(Event.COMPLETE, userOnLoad) isn't working and my program never gets any farther than that.
Here is my code:
import fl.controls.*;
import flash.display.Sprite;
import fl.managers.StyleManager;
DECLARATIONS
var backgroundArea:Sprite = new Sprite();
var loginArea:Sprite = new Sprite();
var userArea:Sprite = new Sprite();
[Code] .....
View 1 Replies
Nov 26, 2010
I've noticed that by using isNaN(number), it doesn't always return true when needed. In fact, by using:
var bool:Boolean = isNaN(parseFloat(numberStr));trace(bool);
It will return true with:
-sdfda
$%&$
asdf
BUT, false (when it should be true) with:
230asdfs
230sdfasd.50
It seems like the letters between the numbers aren't even considered and it returns false when it should in fact return true... If it starts with a letter, it returns true, otherwise, with a number, it's false...I need to check whether or not there are any non-numeric (except "dot") in the parameter "numberStr" (a String).
View 4 Replies
May 6, 2011
I've implemented an internal preloader in my project but it's not working properly. I use Simulate Download but the preloader only shows after something like 80% is completed, which sort of destroys the purpose of the whole thing.
import flash.events.ProgressEvent;
stop();
function preloader(progressEvt:ProgressEvent):void{
var totalBytes:Number = progressEvt.bytesTotal;
var loadedBytes:Number = progressEvt.bytesLoaded;
[Code] .....
View 6 Replies
Oct 2, 2011
I don't really get UncaughtErrorEvent working for my Air 2.6 application. if i step through the code with the debugger, i get very strange results.that's the code:
public class Main extends Sprite{
public function Main(){
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR,
[code].....
View 9 Replies
Dec 29, 2011
I have a Flash gallery that works locally but not after upload.I added several photos to the xml file and only the original 8 jpgs are displayed.URL...
View 5 Replies
Jun 30, 2009
I have a preloader in the first frame. The preloader appears only after 80 percent loading of swf.
View 0 Replies
Jul 6, 2009
The stop() is not working properly as if it were being ignored. I have even recreated a dummy flash document the stop() did work, however, it is still not working on the original design.
View 6 Replies
Aug 6, 2009
I'm setting up some objects connected to classes onto a movie clip dynamically, and although I'm setting the name fine, when I drag another movie clip on top of it and trace for droptarget.name I always get something like "instance01" what am I doing wrong?
View 4 Replies
Jun 26, 2009
i've been going over this code all day and I have no idea what's wrong with it. I'm doing a similiar operation a little higher and that one works so I have no idea why this one doesn't. All I'm trying to do in this case is populate a List UIComponent that I created with information that I get back from the PHP file. For some reason the loader.addEventListener(Event.COMPLETE, userOnLoad) isn't working and my program never gets any farther than that.
Here is my code:
Code: Select allimport fl.controls.*;
import flash.display.Sprite;
import fl.managers.StyleManager;
[Code].....
View 1 Replies
Mar 4, 2011
I sorted this problem before, but it's back again.
Both of my animations work fine in firefox, but don't loop in IE.
ABOUT ME [URL]
KZX ANIMATION 2ND FROM BOTTOM [URL]
confirm that these animations don't loop properly in IE?
View 2 Replies
Aug 25, 2009
When tested my email window opens twice.
There is no target attribute used at all.
Also ?subject= don't work. Subject field blank in email popup box.
Using Flash 8.
on (press, release) {
getURL("mailto:me@thisplace.com?subject=No subject showing");
}
View 2 Replies
Sep 8, 2009
I have created an image gallery for a client using actionscript 2 and xml. I have the gallery pulling in the images and text from the xml file and displaying correctly. The problem is the rollover/rollout affect I need to do. The image need an itunes affect flip, so the image looks like it flips to display a description then when you roll out it should flip back to show the image. The flash so far can be seen here [URL]
The flash works by pulling the image in from xml and putting it inside a place holder MC inside another movieclip. This movie clip contains a mask which creates the flip affect and shows a white box containing text over the image. When you rollover this works fine, but when I roll out the image, and title have disappeared when the white box is removed.
At the moment I have left the rollover affect out (as you can see on the link) but for my own sanity I would love to know why I can't get this to work. I probably havent explained this very well so I have attached a demo of how I am trying to get the rollover affect to work.
View 1 Replies
Nov 25, 2009
have generated a random grid from movie clips stored in timeline. When I click on the movie clips, it should show a trace statement, but it is not working properly. Sometimes it shows the trace message, sometimes it does not show. My code is like this
Code:
package
{
[code].....
View 3 Replies
Aug 18, 2004
I have a Flash gallery that works locally but not after upload. I added several photos to the xml file and only the original 8 jpgs are displayed.Here is the html file.[URL]portfolio_residential_ fireplaces.html
View 14 Replies
Oct 9, 2009
I have had this problem for a long time and have not been able to fix it. I am using ActionScript 1, although if you can help me using AS2 I should be able to change it. I have a static movie clip with no code referring to it called "ship". Its center point is 275, 324.9. I have a series of planets coming down from the top of the screen and I need to check whether you "died" or not. The planets movie clips are contained inside blank movie clips that are there so thre registration point does not change. I was using the code
Code:
if(this.hitTest(275, 324.9, true)){
gotoAndPlay("gameover");
}
View 3 Replies
Dec 22, 2009
attached is the fla which has a part of code i am working on for a project.with help of mouse you can draw a circle on the image, but for some reasons the mouse up event does not work. it works fine when the eventlisteners is attached to the stage, but does not work when its attached to the movieclip.also how can i restrict the circle to be drawn only inside the movieclip which is a rectangle.here is the code
Code:
const CANVAS:Sprite = new Sprite();
var _dragging:Boolean = false;
[code]....
View 3 Replies
Aug 30, 2010
the code which works over stage, is not working properly over a movieclip..sample, i have many objects to stay at different indexes at flash..with that code block below. I add 300 mc's to stage,
Code:
for (var j:Number = 0; j<300; j++) {
var mc2:MovieClip = new MovieClip();
stage.addChildAt(mc2, j);
}
TO be able to change indexes with different items.. i have random movieclips which have to be placed indexes between 5 and 300.. And everything goes great when i do this directly at stage..But when i do this with a movieclip.. example;
Code:
for (var i:Number = 0; i<300; i++) {
var mc3:MovieClip = new MovieClip();
my_mc.addChildAt(mc3, i);
}
i can't see the movieclips inside.. but i know they are at their right indexes..but somehow they are getting behind those fake movieclips..
View 15 Replies
Sep 24, 2010
So I have built a contact form out of AS2 and PHP. PHP 5 is enabled on my server, so that's not a problem. I think there is a slight error within my code somewhere. What happens is once online, you fill out the form and hit post, it goes to the "error sending email!".
[Code]...
View 1 Replies
Oct 17, 2010
I'm putting together a pretty basic website/portfolio. The buttons/code that go from page to page work great. The code I'm using to access larger images from thumbnails is basically the same, however it's not working.I have the site setup so that each larger image is it's own separate page, so basically the thumbnails act as buttons to access a specifically labeled page. Ex- Thumbnail/button "Character1_btn" goes to the page labeled as "Character1" to display the larger image. I hope this makes sense.Below is the code I'm using. As I said- all functions but the character1 function are working properly.. I really need the character 1 function to work.Quote:
stop ();
home_btn.addEventListener(MouseEvent.CLICK,playhom e);
function playhome(event:MouseEvent):void{
[code].....
View 2 Replies
Jan 3, 2008
When I place a flv into a flash movie and apply a skin and publish everything, it works fine on my local machine, but when uploaded to a server the player skin will not show up, yet the flv shows up and begins playing. Has anyone encountered this before? Isthere a way to embed the skin in the swf instead of having it be
View 7 Replies
Jun 30, 2009
gotoAndStop() doesn't work. I am using Flash CS3. My code is simple:
on(release) {
_root.gotoAndStop("menu");
}
I put that code into a button. The menu frame is three frames behind the frame that I put the button on. If I replace the "menu" with "game", it works. The game frame is one frame behind the frame the button is on. What happens is instead of going to the menu frame, it flickers to the menu frame, then reloads the lose frame, which is where the button is. I know that it reloads because I have a dynamic text field that throws a random insult when you enter that frame. I can assure you. I have already double checked and triple checked that the frame label is correct. And the menu frame has stop() in it. I'm not that stupid, alright?
View 8 Replies
Aug 8, 2009
I used the tutorial found here. The 3 frames of my button are in a movie clip, within a keyframe in the main timeline. I used the code at the end in the tutorial for the first keyframe, so that the clip begins with music playing. However; I cannot get the buttons to work. I cannot stop the sound.
View 1 Replies
Jul 15, 2010
Im trying to get cuepoints working on an old as2 project.I have a netstream video component and want the cuepoints embedded in the FLV to trigger buttons to appear. I have embedded them as Event Cuepoints.
ns.onCuePoint = function(infoObject:Object){ trace(infoObject.name); if(infoObject.name == "CP1") { trace("yes working"); }};
[code]...
This shows all of the cuepoints within the FLV. I cant figure out how to change the code to trigger actions WHEN the FLV hits a Cuepoint.
View 2 Replies
Jan 5, 2011
If I have this line of code:
var myTween:Tween = new Tween(contHolderMain, "alpha", None.easeNone, 0, 100, 100, true);
contHolderMain's alph value should move from 0 to 100 in 100 seconds, but it only take about 5.
View 1 Replies