Error 1034: Converting movie clip to instance of a custom object?
I have several movie clips on the stage that each have unique instance names.
I need to instantiate them as instances of a custom class I have created. This is giving me an error, and I know I'm probably missing some simple concept somewhere, doing something wrong, but I don't know what it is.
Here is my code:
In the main timeline, I have (simplified):
var puzzleAL:GeoGroup = new GeoGroup ("AL", "Alabama", 1, false);
puzzleAL.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
function geoTouchBeginHandler (e:TouchEvent): void {
e.target.gotoAndStop("Over");
nameDisplay.gotoAndStop(e.target.abbrev);
e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
function geoTouchEndHandler (e:TouchEvent): void {
if (e.target.lock == false) {
e.target.gotoAndStop("Off");
else if (e.target.lock == true) {
e.target.gotoAndStop("Lock");
nameDisplay.gotoAndStop("USA");
e.target.removeEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
It throws an error before the object is ever instantiated. It compiles, but at runtime I get:
TypeError: Error #1034: Type Coercion failed: cannot convert Puzzleography_fla::Alaska_2@da0a0f9 to GeoGroup.
at flash.display::MovieClip/gotoAndStop()
at Puzzleography_fla::MainTimeline/goToFrame()
My class code looks like this, if it matters:
package {
import flash.display.MovieClip;
public class GeoGroup extends MovieClip {
public var abbrev:String;
public var fullName:String;
public var assignedOrder:Number;
public var lock:Boolean;
public function GeoGroup(abbrev:String, fullName:String, assignedOrder:Number, lock:Boolean) {
this.abbrev = abbrev;
this.fullName = fullName;
this.assignedOrder = assignedOrder;
this.lock = lock;
I'm missing something obvious, I know it, but I'm new to OOP, switching from procedural, so I'm sure I'm getting a concept wrong somewhere.
Thanks so much!
Amber
yes, it makes sense and yes, you'll need to learn a little.
I have 50 movie clips not linked to any actionscript in the movie.
that's incorrect. those movieclips are linked to all the actionscript that applies to their class. so, even if those movieclips weren't part of the GeoClass, they still have all the properties, methods and events of the movieclip class (created by adobe developers).
The fact these movieclips are actually GeoGroup objects extending the movieclip class, adds even more code to them. and, so far that's all good and exactly what you should do.
They are all on the stage. They are all named with their instance names "puzzleAZ" "puzzleTX" etc.
no problem, usually. (but in your case, a problem explained below.)
I want to be able to add variables to them, such as strings and numbers, so that I can call puzzleAZ.size or puzzleAZ.fullName to get "XX Acres" or "Arizona" returned.
so, in programming lingo you want your objects to be members of a dynamic (ie, you can add properties) class. the movieclip class is just such a class.
I created a separate class (GeoGroup) that extends MovieClip that has in it all the variables I need and tried to assign each movie clip to that class.
here's the problem. when you created your GeoGroup class you mandated that certain parameters be passed to the constructor. when you add a class member (like each of those puzzle pieces) to the stage, the class constructor is invoked (along with everything else in that class). However, no parameters are passed to your constructor so the flash compiler points out the issue and refuses to run your code.
there are two ways you could proceed:
1. remove the parameters from the constructor
2. don't add any class members to the stage in the authoring environment.
p.s. this is your GeoGroup constructor:
public function GeoGroup(abbrev:String, fullName:String, assignedOrder:Number, lock:Boolean) {
this.abbrev = abbrev;
this.fullName = fullName;
this.assignedOrder = assignedOrder;
this.lock = lock;
the paramters that contructor requires are 2 strings, one number and one boolean.
Similar Messages
-
I have an Ipod Video 30Gb. My Itunes can´t convert movies to the Ipod-format. What am I doing wrong? When a try, Itunes just shuts down. I have Quicktime PRO and when I try to export the movies from there to the Ipod, it just shuts down too!
Please, help me!
Windows XPokay. let's try swapping out your QuickTime.
let's try this technique first.
head into your Add/Remove programs. uninstall QuickTime.
Next, we’ll manually remove any leftover program files and folders.
1. On the Start menu, click My Computer (or double-click My Computer on the Desktop).
2. In My Computer, open Local Disk.
3. Open Program Files.
4. Right-click on the QuickTime folder and click Delete from the shortcut menu.
5. Navigate to C:\Windows\system32\.
6. Remove the files QuickTime.qts and QuicktimeVR.qtx.
7. Restart your computer.
next, we'll get a fresh copy of QuickTime into your PC by doing a repair install of itunes.
switch off antivirus and antispyware applications prior to the repair install.
go into Add/Remove and select itunes. click "Change" and then click "Repair".
if the repair install goes through okay, restart the PC and try launching itunes again. does it launch properly now? -
How to convert an array collection instance to a complex object for interaction with webservice
Hi there,
I have a stubborn problem that I am trying to work out the best way to solve the problem. I am interacting with a WebService via HTTPService calling a method called find(String name) and this returns me a List of ComplexObjects that contain general string and int params and also lists of other Complex Objects. Now using the code:
ArrayCollection newOriginalResultsArray = new ArrayCollection(event.result as Array)
flex converts my complex objects results to an arraycollection so that I can use it in datagrids etc. Now up until this part is all good. My problem is when getting a single instance from the results list, updating it by moving data around in a new datagrid for example - I want to interact with the webservice again to do an create/update. This is where I am having problems - because these webservice methods require the complex object as a parameter - I am struggling to understand how I can convert the array collection instance back to my complex object without iterating over it and casting it back (maybe this is the only way - but I am hoping not).
I am hoping that there is a simple solution that I am missing and that there is some smart cookie out there that could provide me with an answer - or at least somewhere to start looking. I guess if I have no other alternative - maybe I need to get the people who built the service to change it to accept an array - and let them do the conversion.
Any help would be greatly appreciated.
BertHi Bert,
According to my knowledge you can use describeType(Object) method which will return an XML... That XML will contain Properties and values just iterate through the XML and create a new Object.. Probably u can use this method...
public function getObject(reqObj:Object,obj:Object,instanceName:String,name:String=null,index:int=-1):Obj ect
if(!reqObj)
reqObj = new Object();
var classInfo:XML = describeType(obj);
var className:String = instanceName;
if(name!=null)
className=name+"."+className;
if(index!=-1)
className=className+"["+index+"]";
for each (var v:XML in classInfo..accessor)
var attributeName:String=v.@name;
var value:* = obj[attributeName]
var type:String = v.@type;
if(!value)
reqObj[className+"."+attributeName] = value;
else if(type == "mx.collections::ArrayCollection")
for(var i:int=0;i<value.length;i++)
var temp:Object=value.getItemAt(i);
getReqObject(reqObj,temp,attributeName,className,i);
else if(type == "String" || type == "Number" || type == "int" || type == "Boolean")
reqObj[ className+"."+attributeName] = value;
else if (type == "Object")
for (var p:String in value)
reqObj[ className+"."+attributeName+"."+p] = value[p];
else
getReqObject(reqObj,value,attributeName,className);
return reqObj;
Thanks,
Pradeep -
Targeting Multiple Movie Clips
Hi everyone,
I'm fairly new to ActionScript so I would really appreciate
any help I can receive.
Right, I have a Flash file which contains a movie clip with
an instance called, 'contentHold_mc'. Inside this movie clip are 4
individual movie clips with instances entitled, 'content1_mc',
'content2_mc', 'content3_mc' and 'content4_mc'. I know these are
not the best names for instances, but this is just for simplicty's
sake. At present all movie clips run at the same time. I want them
to run sequentially. On the last frame of the instance,
'content1_mc', I want to stop the instance from playing and start
playing the instance, 'content2_mc'. On the final frame on
'content3_mc', I want to stop the instance from playing and start
playing the instance, 'content3_mc', and so on until 'content4_mc'
finishes playing. I have tried to use the tellTarget function
without success and anyway, I believe this is now deprecated.
Would anybody be able to provide me some guidance please as
to how I can achieve the previous using the 'dot' notation?
I have tried the using the code found at the bottom of this
message in the final frame of the movie clip instance that I want
to play first ('content1_mc'), however get a compiler error because
of the preceding two full stops '..'
Thank you in advance for any help I may receive with this
query.Put a stop(); command at the first frame of each of the
clips. On the last frame of the first clip put:
stop();
_parent.contentHold_mc.content2_mc.play();
repeat as needed for each movie clip.
Tell the first clip to play. -
How to load dynamic text inside a movie clip?
hello all - i have a main stage where on the first frame my
"home" movie clip displays. i did this by dragging/dropping, and
then i put a stop action. all works fine.
inside this home movie clip on the main stage, there are
links to other movie clips. for example, to get to my faq's page -
you click that button, then it takes you to frame 4 on my main
stage, where my faq's movie clip (followed by stop action) has been
dragged/dropped and displays properly.
within the faq's movie clip this process is repeated, with
buttons taking to you various pages (different frames where
different movie clips play - all works fine).
so now i want to add a dynamic text field within my faq's
movie clip. i have read numerous tutorials where i have created the
text file but i have not been able to display it with success
within my faqs movie clip.
here is some code that my dvd tutorial instructs me to place
on main stage as i practice getting this to work:
var myMCL:MovieClipLoader = new MovieClipLoader ();
var myListener:Object = new Object();
myMCL.addListener(myListener);
var myLV:LoadVars = new LoadVars();
myLV.onLoad = function (success:Boolean) {
if (success) {
_level5.loadedInfo.htmlText = myLV.info;
} else {
_level5.loadedInfo.text = "There has been an error loading
the requested information. Please contact the webmaster.";
and here is some code that i place on the faqs button within
my main movie clip that takes me back to main stage and plays faq
movie clip all successfully:
on (release) {
//Movieclip GotoAndPlay Behavior
_root.gotoAndPlay("4");
//End Behavior
and finally, here is some code that i place within my faqs
movie clip in an attempt to display my dynamic text within the faqs
movie clip - so far unsuccessful:
_level0.myLV.load("vars/faqs.txt");
NOTE:
i have published this to view - not working.
i have my faqs text file starting as info=
i have eliminated white space within my text file
i am using flash 8 pro
can anyone offer some sugestions? thanks!hmmmmm lemme double check as i seem to be a bit lost now.
// this is my actions layer code on frame 4 of main timeline:
stop();
var myLV:LoadVars = new LoadVars();
myLV.onLoad = function (success:Boolean) {
if (success) {
_level5.loadedInfo.htmlText = myLV.info;
} else {
_level5.loadedInfo.text = "There has been an error loading
the requested information. Please contact the webmaster.";
myLV.load("vars/faqs.txt");
1. fyi - at frame 4 on main timeline, one layer beneath the
actions layer where i dragged/dropped my faqs movie clip i gave my
faqs movie clip an instance name of "mainfaqs" - although nowhere
do i refer to this specific mc within my code.
2. where would i replace/insert the following code?
_level0.faq_mc.loadedInfo.text = myLV.info;
3. i didn't know about embedding font but i saw the option
and embedded it - still no results.
4. i'm not sure how to do the following:
_level5.loadedInfo.text ='test'; //although I would still
change the path as above
To see if your getting a return from the load call adn text
file, use a trace statment before the success condition and see
what it returns:
trace(myLV);
sorry to be such a pain - i really have looked around for
answers through previous postings and i googled it and i've been
taking instruction through lynda.com and dvds but i seem to be
stuck here.... as always - thanks for your time -
Once I select all the input fields along with titles, I
create the new movieclip and name it form. This will be the form
movieclip. And do I check 'Export for Actionscript' in the linkage
area? Perhaps, I did not do that prior.Mary Alice,
> Whoops. No variable name for the FORM, only an instance
of
> name: FORM. And it does not seem to have an instance
name.
First all, I need to clarify a major typo in my last post. I
totally
destroyed the object reference I've been trying to explain,
so please accept
my apologies, and I hope my current reply will clarify
matters.
Because your path contains the expression "form_mc," the
instance name
of that movie clip -- the one that's holding all the text
fields -- needs to
be form_mc (because that's the name in your path).
Think of this in terms of folders on your hard drive; it's a
great
analogy to what's going on here. That button interprets the
ActionScript
object reference like this: "From my own point of view
(this), I'll look up
one 'folder' to the timeline I'm in (_parent). From there,
I'll look look
for an object with the instance name form_mc. That movie clip
contains a
number of nested objects, one of whose instance names is
household_txt.
That nested object is a text field, which means it has a text
property.
That's what I want." So, string those all together and you
get:
this._parent.form_mc.household_txt.text;
That's the location of one of the text fields from the point
of view of
the ActionScript associated with your button. In my last
reply -- I'll
blame it on a lack of coffee today (lame excuse!) -- I put
that object
reference (that "folder path," if you will) in the wrong
place.
Consider what you're after, though, it it should make sense.
Since the
ActionScript is associated with the button, everything must
be taken from
the button's point of view. The LoadVars instance is created
inside the
button, so from the button's point of view, the LoadVars
instance (my_lv) is
right there.
e.g.
on (release) {
my_lv = new LoadVars();
re_lv = new LoadVars();
So far, so good. If you want to refer to my_lv or re_lv
again while
inside this on() handler, no object path is necessary. If you
wanted to,
you could use this.my_lv or this.re_lv, but even without the
"this," the
path to these objects is understood: they're right here. So,
as you create
new properties for the my_lv object, you name the object and
its new
property ...
my_lv.household =
... and set that new property equal to the value of the
TextField.text
property of one of your text fields in the path we just
covered; namely,
this._parent.form_mc.household_txt.text. So ...
my_lv.household = this._parent.form_mc.household_txt.text;
... and so on, with the rest of them:
my_lv.water = this._parent.form_mc.water_txt.text;
my_lv.soft = this._parent.form_mc.soft_txt.text;
// etc.
Does that clear it up?
Note: even after you update all of this, you may still run
into
problems, so keep your chin up. There's a lot going on here,
and you'll
need to work through each concept until you get it. The
concept we're
working toward right now is object references.
> Or, is instance of the same as instance name?
The term instance refers to an object made from a template.
If you use
the drawing tools to create some artwork and convert that
artwork into a
movie clip, a new movie clip symbol will appear in your
Library panel. You
can drag as many copies of that movie clip symbol to the
Stage as you like.
Doing so means you're creating that many "instances of" the
MovieClip class;
in particular, "instances of" a very specific movie clip in
your Library.
Every dynamic or input text field you create, even if it
isn't symbol, is
automatically an "instance of" the TextField class. Even if
you don't give
them instance names, they're still instances of the classes
(the type of
object) they represent. But without instance names, it's much
hard to get
ActionScript to speak directly to any of them.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Changing movie clip to graphic causes white screen?
Using two instances of the same symbol in a project. When I test the project after placing the first instance on the stage as a movie clip, project works fine. When I place the second instance on the stage as a movie clip, project works fine. When I convert movie clip to symbol, the screen comes up white when I test project. When I break the symbol into components, screen still appears white. Even erasing the graphic instance or the componentes still causes the screen to come up white. Only solution I've found is using undo.
Has anyone else experienced this? Converting to movie clip to symbol "whiting out" your project? I'm refraining from adding sample code just yet, because code is pretty bulky and not sure what or if it would be relevant. Wondering if there's s known cause of something like this that doesn't require me to post codeDon' try to use the same symbol as two different symbols types
-
Hi, i am a bit of a newbie at AS & need some help applying it to a movie clip button
I have created a movie clip button but am stuck with the actionscript. I have created the rollover and rollout for this movie clip button but i want it to do 2 things after this i want it to go and stop on the first frame of a movieclip which has my content on it called portfoliogallery_mc (which is also the same instance name for it) when you then click the button i want it to go and play frame 11 of that movie clip portfolio gallery_mc.
Here is my current actionscript i HAVE Flash 8 on my comp that i am currently using.
Please note my actions are on a layer called actions and not on the movieclip button itself.
nxtimagetwo_mc (is the movie clip button/instance of mc)
THE CODE I HAVE USED
this.nxtimagetwo_mc.onRollOver = function() {
nxtimagetwo_mc.gotoAndPlay("_over");
this.nxtimagetwo_mc.onRollOut = function() {
nxtimagetwo_mc.gotoAndPlay("_out");
portfoliogallery_mc.gotoAndStop(1);
portfoliogallery_mc.gotoAndPlay(11);
currently it is playing to frame 11 not stopping at frame 1 and stops on frame 20 where i have a stop action. I also have a stop action on frame 1 of that movie clip.
What I want it to do is first stop at frame 1 of that movie clip and when the button is clicked again to go and play frame 11 of that same movie clip.
Basically what i want the mc button to do is 2 things automatically stop the mc for the first content and when button is clicked let the content fad out and play to where the next stop action is set to in the Movie Clip.
Nothing to with the above www.rsquareme.co.uk is my current portfolio website if you would like to check it out it is not fully complete yet.it doens't make sense to execute:
portfoliogallery_mc.gotoAndStop(1);
portfoliogallery_mc.gotoAndPlay(11);
only the 2nd line of code will be effected.
i know you want to control 2 movieclips. what are the instance names of the two movieclips and what do you want to occur in each of those movieclips.
or, do you want to control 1 movieclip and have it play a certain sequence of frames followed by another sequence of frames? -
Controlling flash movie clips...
I made a flash animation using timelines and broke my movie up into three clips. The clips run fine in their own time line. I was reading about clip.play() clip.stop() and it seemed like I could do this. I have a main timeline with three frames. Each frame has a movie clip symbol on it. Each movie clip symbol has a timeline a few seconds long in it.
I did this because I want to put a click event that will go to a different url depending on which clip the viewer is currently seeing. This swf file will be embedded into an html document.
When I run the resulting swf - the three frames on the main timeline zip along like crazy and the movie clips don't play at all. I've tried every combination of stop() and play() I can think of but this is just not working as advertised...
My movie clips have instance names of Clip1, Clip2 and Clip3. Can someone help me with
1) some sample code that works so that I can run these clips in consecutive order;
2) the appropriate onClick code to use in the main timeline frames for my url events
Thanks much.
BCI had to put this on hold to make a deadline and never really got back to it until just now - another similar request. So here is a modification to the code provided to me that I made and seems to do exactly what I wanted. I am not an expert at script but I haven't had a problem with this so I am going with it. If this helps anyone else - great! I never got a reply from the original poster on how to fix the problem where the script they provided looped around on my final movie clip.
This is the code I used in frame one to control the loop for the three movie clips:
var myMov:MovieClip
myMov = Clip1
this.stop();
// myMov.play()
this.addEventListener (Event.ENTER_FRAME, onEnterFrame); function onEnterFrame (event:Event):void {
// is "myMov" current frame, play head, at the end of "myMov"
if (myMov.currentFrame >= myMov.totalFrames) {
// if it is then move the main timeline on 1 frame
if (this.currentFrame == 3) {
myMov = Clip1;
this.gotoAndStop (this.currentFrame-2); }
else {
this.gotoAndStop (this.currentFrame+1); } -
Movie clip plays onRollover?
When someone rolls over a button, I would like it to play a
movie clip.
I place the movie clip on the rollover state though it is not
working.
1. Am I doing this right?
2. What if I want the movie clip to play somewhere else on
the stage.
How do I position the movie clip while in button edit mode so
it is in
the location I want it to be when it is actually placed on
the stage?
Thanks.dave wrote:
> When someone rolls over a button, I would like it to
play a movie clip.
> I place the movie clip on the rollover state though it
is not working.
>
> 1. Am I doing this right?
Not really the right way. Tho, You can place movie clip in
over state of the
button but then you have no control over it as the states
reset as soon as you
move the mouse out of the HIT area. You need to place the
clip outside of the
button, give it instance name and target that instance name
using button handlers,
like on roll over or on press.
> 2. What if I want the movie clip to play somewhere else
on the stage.
> How do I position the movie clip while in button edit
mode so it is in
> the location I want it to be when it is actually placed
on the stage?
button with instance name myBtn and movie clip with instance
name myMovie.
On timeline frame following action:
myBtn.onRollover = function(){
myMovie.play();
Best Regards
Urami
"Never play Leap-Frog with a Unicorn."
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
Time line change with Movie Clip!
Help, I want a movie clip to interact with another to change the scene.
this is my code on the "Door":
onClipEvent(enterframe) {
if (_root.char.hitTest(this)) {
_root.gotoAndStop("Game2", 1);
Game2 is my next scene name.
but it is not working!
Why is that!
the other movie clip's instance is "char":Take the code off of the object and place it in the main timeline, modifying it as shown...
this.onEnterFrame = function(){
if (char.hitTest(Door)) { // replace "Door" with the instance name you gave it
delete this.onEnterFrame;
gotoAndStop("Game2", 1); -
Using MouseEvent with Movie Clips
Hopefully i have a real easy question. I have a movie clip
that i saved in a library. I gave the movie clip an instance name
so I can instantiate the movie in my document class. The movie clip
itself has 3 layers.
So i instantiate the movie clip, add a mouseevent to the
movie clip instance and then add it to my stage(addchild()). My
problem is that the MouseEvent.target could be any of the 3 layers
of my movie clip, I was expecting the MouseEvent.target would be
the entire movie clip. So when i go to change the x, y position of
the MouseEvent.target, only the 1 layer moves and my movieclip
becomes disjoint.
Hopefully someone can give me an easy way to test to see
which layer is returned by the MouseEvent and then I can move the
entire movie clip instead of just the one layer.
Thanks in advance.NedWebs, you hit it on the head. My movie clip is made up of
movie clips(I dont know what the proper terminology of the
movieclip that contains the other movie clips, parent movieclip?).
So is there a way to get back to the parent movieclip when
one of the children movie clips are targeted? In my action script i
only instantiate the parent movieclip, so i assume the children
movie would have to be related to the parent movieclip in some
fashion.
So when my MouseEvent.Target is one of those child movieclips
I need to somehow reference the parent movieclip and move it..
I dont have the code here with me, but I can post it when i
get home tonight.
PS. I guess i should have created this topic in the AS 3.0
forum. -
Hi,
I have this problem. I have movie clip with instance name mc1
and it's placed on the stage of the root movie clip. Inside mc1 I
have movie clip with instance name mc2.
I want to access mc2 from the root movie clip. If mc2 is on
the first frame in mc1 - there is no problem - I use mc1.mc2 . But
if I place mc2 on the second frame then flash throws exception.
I use Flash CS3 + AS3.
Thanksquote:
1. You can place it on the frames that need it. You can set
its _visible property to false on frames it should not be seen or
move it off stage.
I'll use this one. Thanks for the respond. -
Hide movie clip of external swf
Hi there.
I have my main.swf and in the second frame i load an external swf called first.swf with this method:
[AS]var loader:MovieClipLoader = new MovieClipLoader();
this.createEmptyMovieClip("myGalleryContainerproducts",5);
myGalleryContainerproducts._lockroot=true;
loader.loadClip("first.swf",myGalleryContainerproducts);
myGalleryContainerproducts._y =86;
myGalleryContainerproducts._x =50;
[/AS]
In first.swf i have two movie clips with instance names ena and dyo
I want in main.swf in the third frame to hide these movie clips of first.swf (only the movie clips not the whole .swf) or to move them (change x and y values) so they practically hide.
Any solutions?
Thank you in advanceYou will need to wait until the file is loaded to be able to interact with it, so if that might be an issue timing-wise then look into using the addListener method of the MovieClipLoader class. If the movie is loaded you should be able to access the movieclips within it using the movieclip name you assigned (mygalleryContainerproducts) to target them.
-
Movie clips within movie clips
I have a movie clip (I'll call it B_mov) inside another movie
clip (A_mov). When you click a button in A_mov, B_mov plays. At the
end of B_mov, I used stop(); to make it stop. How do I return to
A_mov from there? I assume this is ActionScript territory.
This is coming from someone who has just taken his first baby
step into AS, navigating a single timeline via buttons, but I have
no idea how to move between different timelines.
Is this something that can be easily explained? If it's
really complicated, I don't want to burden anyone.
...Would I be better off finding an online AS tutorial? Can
someone please point me in the right direction?supaaman,
> I have a movie clip (I'll call it B_mov) inside another
> movie clip (A_mov). When you click a button in
> A_mov, B_mov plays.
Okay.
> At the end of B_mov, I used stop(); to make it stop.
Makes sense so far. :)
> How do I return to A_mov from there? I assume this
> is ActionScript territory.
Well, you've already entered ActionScript territory by
programming your
button and adding that stop() action, so that's a good thing.
When you say
"return to A_mov," what do you mean? What would like like
A_mov to do at
this point?
> This is coming from someone who has just taken his
> first baby step into AS, navigating a single timeline
via
> buttons, but I have no idea how to move between
> different timelines.
Timelines are synonymous with movie clips, and movie clips
are defined
by something called the MovieClip class. In fact, all objects
in
ActionScript are defined by corresponding classes (text
fields are defined
by the TextField class, arrays by the Array class, and so
on).
Thinking of it this way, you can consult the MovieClip class
entry of
the ActionScript Language Reference (the Help panel) to find
out everything
you need to know about movie clips. The characteristics of
the object are
called properties (you'll find references to width, height, x
and y
position, etc.). Things the object can do, such as stop(),
play(), and the
like, are called methods. Things the object can react to --
mouse clicks,
for example -- are called events.
You haven't stated what version of ActionScript you're
using, and the
exact wording of your code depends on that, but for example,
in ActionScript
2.0, you'll find that movie clips have a _parent property (in
ActionScript
3.0, it's simply parent). This property allows the movie clip
in question
to refer to its parent timeline (that is, its parent movie
clip). That
might be a step in the right direction for you, but I'm not
sure what you
have in mind.
Instead of simply invoking stop() in the final keyframe of
B_mov, you
might do something like this:
stop();
_parent.play();
... which invokes the MovieClip.stop() method on B_mov's
timline (because
that's where the reference to stop() appears: in B_mov's
timeline) and then
makes a reference to B_mov's parent via the MovieClip._parent
property.
That reference therefore invokes MovieClip.play() on A_mov.
The reason it works here is entirely because of the point of
view from
which the code operates: namely, keyframes in B_mov's
timeline. If your
code were all on the main timeline, your methods would be the
same -- stop()
and play() -- but your object references would be different.
Does that make sense?
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design."
Maybe you are looking for
-
Connect to Oracle 8i from Forms 6
I have installed Personal Oracle 8i and developper 6 in a NT. I got the error when tried to connect to the Oracle 8i from Form Builder. "could not resolve service name". I did enter the database name. Any ideas?
-
A good viewer for photoshop, indesign and illustrator files.
Hello everyone. I work at an designers firm, and we are avid users of the Adobe Creative Suite. However, it's expensive software, and certain people at the company only have to view the files we create. It's a bit of a hassle to create PDFs for them,
-
Photo Stream won't update onto PC
My photo stream file on my PC's hasn't updated since Oct 2013. I can't figure out why it's not automatically updating from the cloud like it's supposed to. I've checked the settings on my Iphone and Ipad, but everything seems to be as it should be.
-
Diff between at-new and on-change of in loop events
diff between <b>at-new</b> and <b>on-change of</b> in loop events
-
Zoom shortcuts on Reader 10.1.1 and Mac OS 10.6
Hello, I'm using Mac OS 10.6.8 and Reader 10.1.1. Ever since I upgraded to Adobe Reader 10 I have had problems with the zoom shortcuts (i.e. command + , command -). Instead of zooming, command+ rotates the document, and command- simply does nothing.