ActionScript 2.0 :: AttachMovie - Reference The Particular Frame?
Nov 5, 2003
I'm making a game...and I want to change my background image depending on where the character is.I thought I would make a MovieClip...with all the different background images on different keyframes.My question is....can I use AttachMovie, and if so...how do I reference the particular frame that I want to...?I've never used AttachMovie before, and wasn't sure of the syntax...and how to reference it...to go to a particular frame.
View 1 Replies
Similar Posts:
Jan 31, 2008
I am trying to write an attachMovie statement with a variable feeding the ID parameter.[code]...
View 1 Replies
Mar 10, 2010
I have 3 pages of a document converted to symbols (i.e. mc_pg1, mc_pg2, mc_pg3), each residing in its own frame (i.e. "pg1", "pg2", "pg3") inside mc_Pages. Mc_pg1, mc_pg2, and mc_pg3 are inside a movieclip called mc_Pages. On click of mc_Pages, I am attaching a blinking icon (mc_Target) to a specific page. The problem I'm having is when I attach mc_Target to a specific mc in its frame, navigate to another frame, and then return to the initial frame, mc_Target is no longer attached. Yet, I have not clicked anywhere else other than the buttons that allow me to navigate from one frame to another. So, my code is:
mc_Pages.onPress = function():Void
{
if(varPg1 == true) //this checks to see if I'm on "pg1" frame where mc_pg1 is located
{
[code]....
Everything is working as it should, i.e. on press of the mouse button, the mc_Target is attached to the frame/mc within mc_Pages that I'm in (I have a btn_Next and btn_Previous on the same timeline as mc_Pages that navigates to the specific frames inside mc_Pages), except that upon returning to a frame/mc which previously had mc_Target attached, mc_Target is no longer there.
View 5 Replies
Jun 19, 2005
is it possible to use attachMovie without exporting the MC in the first frame.because i tried to do it so i wouldn't have problems preloading, but when i uncheck export in first frame it doesn't show up at all. here is my code just in case it mattered.
i have five buttons 'b1, b2, b3, b4 and b5' and 5 mc 'words1, words2, words3, words4, and words5' being attached to an empty mc on root called 'holder'.
Code:
for (var i = 1; i<6; i++) {
_root.nav["b"+i].onPress = function() {
num = this._name.toString().substring(1, 2);
_root.holder.attachMovie("words"+num, "words"+num, _root.holder.getNextHighestDepth());
};
}
View 3 Replies
Aug 10, 2004
I have 5 frames in a Flash file. The fifth frame is the only frame that contains several attachMovie actionscript call lines. Each of the clips that are called using attachMovie contain large image file sizes. When I used debugger, I noticed that the bulk of the data is not being loaded from the 5th frame, but from the 1st frame instead. Is this supposed to happen? If this is so, the preloader that is being referenced on Kirupa doesn't seem to work properly because it loads all the attachMovie frames first before the preloader is able to perform its own action. What happens is that 80% of the movie will load (I predict from the attachMovie call lines) before the preloader actions and its visual representation will appear.
I tried directly attaching these movieclips to the last frame along with the attachMovie(), thinking that phyiscally placed frame would have a higher priority. But the debugger still informs me that the bulk of the data is being loaded at the 1st frame. Is there another workaround for this or another preloader that someone can recommend? This is the preloader I used: [URL]
View 2 Replies
Oct 12, 2006
I have this really simple actionscript function and for the life of me i cannot figure out the correct way to pass in the frame reference name![code]
View 4 Replies
Jul 4, 2011
Is it possibile to access a mc, which is present in next frame? While we are focusing in the previous frame. I need to feed some data for the mc which is in next frame. So, How to get that name of the mc?
View 1 Replies
Oct 31, 2009
Currently i am working on a project and i need the gallery to appear when a movieclip boxp_mc gets to frame 11 i have this in a function that i call onRelease of a button. However it donsnt seem to read this write. As soon as i click portfolio_btn it traces "dosnt work" i feel its reading it right away. I want it to wait till it gets to frame 11 then to this.
_root.portfolio_btn.onRelease = function() {
gotoAndPlay("bportfolio");
gallery();
[code]....
View 1 Replies
Jan 19, 2012
Is it possible to reference frame labels as numbers for comparisons, so that if you make changes to an animation all the numbers change with the labels (instead of hard coding in the frame numbers).
For example, I have a line that is essentially of this structure[code]...
View 3 Replies
May 30, 2009
I'm trying to reference a specific frame inside a MC in my .swf file from an .as file.What I want is to capture the current frame of the movie clip for the .as file. It's for the purpose of points when you shoot each plane. It's an easy trick of frame 1's plane would be worth 100 points, frame 2's plane 200 points, etc.I thought I'd write a line like this in my collision detection section of my .as file.
Code:
planePoints = currentFrame * 100;
The only problem is, of course, it grabs the current frame of the main .swf timeline that my flash file uses, and not the movieclip that's being called to produce the planes.So I thought I'd be able to specify a path to the movie clip (in this case it's called Airplane in the MC's linkage properties)
Code:
planePoints = Airplane.currentFrame * 100;
Then, of course, it freaks out and says that 'access of possibly undefined property currentFrame through a reference with static type Class.'
I still get confused with AS3 and the way items are handled vs AS2. I've lost track of how many times I type _root.
View 2 Replies
Jan 17, 2011
I'm using Flash Professional cs5/AS3 I'll try and describe this the best I can. I'm new to ActionScript. So, in my timeline I have a var on a frame that represents "lives" and i have some code in the timeline that takes down the number of lives depending on certain events, which all works great.
so, now i wanted to make a constructor class that I could reuse for a bunch of movie clip objects and I only want these objects to be able to move if the lives variable is greater than certain number. So now, building my constructor class for these objects i just wanted put an if statement that is looking to see if the lives are greater than a certain number, which if it is then should make these objects do what i want...But, when i run the project I get "1120: Access of undefined property lives."
lives is the var I made obviously like I said, and it works fine being referenced everyone else except when I make a new .as file for these objects then try and reference it. I get the same error when I try and establish "lives" in the main project class too. I'm not sure where I should put this var or how I can make it so i can reference it from an object class. I'm not really sure how to word or describe my issue which has made it hard to search for a tutorial.
View 3 Replies
Jan 5, 2012
This is my code in Flash/AS3, in a frame's action:
import flash.events.Event;
stop();
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void{
[Code]....
This is because I believe it is referring the splashTimer1 function by "this".
How can I refer to parent frame there, so that I can remove its event listener.
View 2 Replies
Jul 20, 2011
I'm trying to make a flash site with that automatically resizes to fit the users browser. the code i used is :
[Code]...
i keep getting the error "cannot assign to a non-reference value.
View 3 Replies
Jun 8, 2011
I'm trying to reference objects on the stage in the current frame from a document class in Actionscript 3 in Flash CS3. In this example, I'm trying to get at a dynamic text field with the instance name "question_txt", but there are also buttons and other things I'll need to get at to put event listeners on and such.
I have "Automatically Declare Stage Instances" checked in the publish settings, so the references should be there -- in fact, if I try to declare them in the class, I get errors about a conflict with the name -- but when I try to reference these objects (in any of several ways I've now tried!) I always get Null.
package {
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.Stage;
import flash.text.TextField;
import flash.net.navigateToURL;
[Code] .....
View 3 Replies
Sep 8, 2009
Here's my code:
[Code]...
I'm just asking it to go to next frame (which is frame 1 of next scene) when it enters the described frame label. how to avoid this error message?
View 6 Replies
Mar 14, 2011
there is a movieclip named movie with instance name movie.Inside this movie there is a textbox in frame 1.I want to give properties and methods to that textbox.
View 1 Replies
Jun 9, 2011
I have a movieclip with two frames. Each frame has externally loaded text with associated CSS. The first frame works fine. However, when I click the button that takes me to frame 2 I get this error:
[Code]...
View 4 Replies
Jul 2, 2009
Is it possible for me to have 1 movieclip consisting of multiple movie clips, in a .fla file, and reference specific frames of clips within a frame of the movie clip, from an outside .as file?
In a .fla file I have a movie clip that consists of several frames, each containing a different movie clip to perform different actions of a character I am attempting to animate.The basics of the code work fine, but now I'm trying to get into more detailed aspects of the characters actions and interactions and all the tutorials that I've come across thus far direct me to add various aspects of code throughout my animation which I feel would litter my program as this project grows.My basic code is as follows
class hero extends MovieClip{ variable definitions up here [code]...........
This works fine.Beyond this,I have a frame with the anchor lable "Punch" which contains a movie clip consisting of 5 frames.Is it possible for me to reference specific frames within the movie clip within this frame of the big movie clip?
View 3 Replies
Apr 11, 2012
I need to remove the word Button from the reference to reference the actual item that will be tinted.
[Code]...
View 1 Replies
Sep 3, 2007
I'm having this frustrating error showing up and I have no idea why. Let me show you my classes and see if you can spot anything wrong.
First, here's my ILode interface:
ActionScript Code:
package com.schelterstudios.lodeSystem.flash.lodescode].....
So the problem I'm having is the compiler is throwing that 1000: Ambiguous reference error for any reference to instance.priority or instance.label. Why??? Instance is typed to IFlexLodeInstance, and IFlexLodeInstance lists method signatures of priority and label getters, and it inherits ILode, which lists method signatures for priority and label setters. What can I do to get the compiler to stop complaining?
View 9 Replies
Jul 7, 2011
My code is an external .as file. Google provides this code on their demo, which contains the this keyword:
[Code]...
Notice that I have 4 calls to console.log. The first 3 fire, but after the new GATracker statement, the 4th does not fire. I have a feeling that I'm overriding the entire package with the object created from new GATracker when I should be passing a different context. I believe the correct context I should pass is whatever this defaults to when not inside of a package/external file, I assume it references the main stage object.
View 2 Replies
May 6, 2010
package uk.co.bigroom.utils
{
import flash.utils.Dictionary;
/**
* Class to create a weak reference to an object. A weak reference
[code]....
In this Class, how they denote one as Weak Reference and one as Strong reference.
View 1 Replies
Oct 11, 2009
I created the following AS for a particular frame
Code:
cnx.addEventListener(CNXConnection.DIGITAL, onDigital_10);
function onDigital_10(e:DigitalEvent)
{
[code]....
While debugging everything works properly if I'm testing that frame.But, pushing a button in another frame, I get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference at "frame number:raw number"
I'm quite sure that the problem is that the variable e.Join changes its corresponding e.Value pushing a particular button in another frame (as must be). Any ideas how to link that information to the frame that create the error?
View 1 Replies
May 14, 2009
Through attachMovie I have loaded an mc from the library onto the stage into "holder_mc".
myButton.onRelease = function () {
if (currentWork != "holder_mc.myWork1_mc") {
holder_mc.attachMovie("myWork_mc","myWork1_mc", getNextHighestDepth());
currentWork = "holder_mc.myWork1_mc";
}
}
This works.
However, there are a couple of buttons (mc) inside "myWork1_mc" which skips through a few slides in the myWork1_mc clip that I cannot target. I thought using:
holder_mc.myWork1_mc.buttonName_mc.onRelease = function () {
trace("MC_pressed");
}
... would work. My curser doesn't even change to the hand symbol. How do I target an dymanically loaded MC from the library which is inside an empty holder MC on the stage via attachMovie? What am i missing? Believe me, I have spent hours trying to google it.
Note: at this stage there is no other script on "holder_mc", but there will be at a later date, but I'll cross that bridge when I get to it. Also, the buttons work when I place the MC onto the stage and not use attachMovie.
View 6 Replies
Oct 3, 2009
i was wondering if it is possible to use attachMovie with variables using flashvars from html. im kind of new to AS and would like to know if anyone could help me out here
i need to make a single SWF in wich some movieclips can be replaced by others through the html code without editing the swf file.
i already know how to enter the variables on the html, but i dont know how to apply this to attachmovie command in the flash file.
View 3 Replies
Dec 23, 2009
So a clip is attached to a clip, and that works fine, but how do I get code on to the attached clip? I've tried duplicateMovieClip...but it's not working...
View 1 Replies
Nov 21, 2007
I have my flash on multiple scenes, and would like to play an animation when clicking on the navigation button before switching to a different scene.
I'm halfway to accomplishing this.
Here is what i used
Code:
_root.gotoAndPlay("changepage1");
_root.onEnterFrame=function(){
if(this._currentframe=="changepage2"){
[Code]....
The above code is on a blank keyframe. Changepage1 is the start of the animation and Changepage2 is the end of the animation.
Upon clicking the navigation button it plays the above scenes.
However it doesn't change scenes to scene "Home2".
View 1 Replies
Oct 8, 2009
for (i=0; i<policy.length; i++) {
newOpt = Stocklist_MC.attachMovie('Option', 'Option'+i, i);
I've got a ScrollPane on the root stage. This loads a MC called 'Stocklist_MC' (this also has a linkage/export name of 'Stocklist_MC'). When I try to use '.attachMovie' to the movieclip (Stocklist_MC) inside the ScrollPane nothing appears. All the AS is on frame 1 of root. Everything works when I use '.attachMovie' with _root. for (i=0; i<policy.length; i++) { newOpt = _root.attachMovie('Option', 'Option'+i, i); Also, if I drag Stocklist_MC to the stage I get everything working but list gets cut off at bottom, which is the reason why I need it in a scrollPane.
View 1 Replies
Aug 11, 2010
the traces get triggered, which means so should the attachMovies, but nothing else seems to happen?[code]
View 3 Replies
Aug 24, 2010
I've been battling this project, and finally got it all wrapped up and working, and was feeling pretty proud of myself, and then I went and posted the exact same .swf on the web and it doesn't work anymore.Specifically, there are a bunch of icons which are placed into the FloorMC which then attachMovie a copy of themselves into a LegendMC and UtilityRefMC, but they dont seem to be attaching anything when I run it through a browser.[URL](I'd love to attach the swf and fla to this message, so you could take a look at those, but apparently that would be crazy.) thought perhaps it had to do with me using _root, but I went through and changed them all out to _globals and _parents and it still no likey. Furthermore the Comment Box in the bottom left gets triggered by _root commands form all sorts of different levels, and it seems to work fine, both on the web and off.
View 6 Replies