Professional :: Target A MC From Within A Function In CS3?
Apr 23, 2010
When trying to target a MC from within a function in CS3, I often run into problems though I still can't put my finger on it. When targeting the movie clip outside of a function (in this case I'm populating some dynamic text fields) everything is fine. In those cases, I use "this." in front of the MC name. I've tried that syntax and the the MC instance name without "this." within the function and nothing. So I seem to be missing something fundamental about AS3.
View 10 Replies
Similar Posts:
Apr 29, 2010
i'm trying to target a function in one class from another. i'm able to call the function using(public static function imagecount()) but i can't a variable out side of that function. when i do i get this error:
1120: Access of undefined property _imagecount.
so below from call 'person' i want to call fucntion 'imagecount' in class 'model'. the call works but when i try and define a variable in class 'model' that is incremented in the 'imagecount' function i get the above error. it seem that my function has to be of type public static to be accessed from the other class.
///////////////// model class
package com.model
{
import flash.events.*;
[Code]....
View 3 Replies
Oct 11, 2009
ActionScript Code:
import gs.TweenMax;
import fl.motion.easing.*;
var where:String
buttongroup.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
buttongroup.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
[Code] ......
View 1 Replies
Oct 7, 2009
'm trying to break out stuff that happens on a mouse click into a function so that function can be called at another time. here's what i'm trying to do:
function itemClicked(e:Event):void {
passoff(e.target);
trace(e.target.name); //menuItem1
[Code]....
the above is obviously not working but i'm wondering how this should be done.
View 1 Replies
Mar 8, 2011
What I'm trying to do is have a website where there are menu buttons on the sides and when you Mouse Over any of the buttons, the picture in the middle changes. Ideally I'd like to set it up so that the image in the center stays until the next button is touched and then it is removed and replaced with another button. Now I could manage this inside the timeline, but it would take a very long time so I'm trying to figure out how to do this with AS3.This first bit of code I used was as follows:
Code:
home_btn.addEventListener(MouseEvent.MOUSE_OVER,HomeShow);
home_btn.addEventListener(MouseEvent.MOUSE_OUT,HomeHide);
[code].....
View 1 Replies
Feb 22, 2012
How can I combine the following functions and still pass a different string to the buildUI(); function?
I have two functions that do the same thing only at the end they both call a function and pass a String value to the function. This string value is the only thing different.
Below is are my eventlisteners and functions as they are now:
female_start.addEventListener(MouseEvent.MOUSE_DOWN, startFemale);
male_start.addEventListener(MouseEvent.MOUSE_DOWN, startMale);
//FUNCTIONS THAT DO THE SAME THING AND BOTH CALL buildUI BUT PASS A DIFFERENT STRING.
[Code].....
View 1 Replies
Sep 16, 2009
I made a flash site and one of the pages has drag and drop functions with drop target actions, so that text appears once dropped onto a target.It works fine but when I have it loaded inside an external editor, the drop and drag still works but the drop target function stops working.
View 0 Replies
Oct 19, 2008
I've created an empty movie clip on the stage called 'photographs', to which I've attached a movie which I've given the instance name 'p1_mc'. This movieclip contains another with an instance name of 'p1_mc_base', which in turn contains a third with an instance name of 'close_btn'.
I need to target 'close_btn' to call an onRelease function. I'm thinking the path would be:
_root.photographs.p1_mc.p1_mc_base.close_btn
which is borne out when I list the objects in the movie, but I can't get it to work. I've used getNextHighestDepth() with the createEmptyMovieClip and attachMovie functions.
View 1 Replies
Oct 19, 2009
I created an array with movie clips now how can i target one movie clip with event handler function . so that when i clicked on one movie clip a message should be displayed
View 4 Replies
Aug 2, 2010
does anyone know if it's possible to target values stored in an array in a function from anywhere in a movie? e.g var Pressed:Array = item trace(Pressed)
if i trace the Array name within the function it spits out values, but when i try and access the Array from outside of the function it doesn't work.
View 1 Replies
Apr 15, 2006
I need to feed the path of a target to a function and it needs to rewrite to set a value to it. example below
[Code].....
Basically it works if it's only one target name with no previous/subsequent targets like path1 works but not path1.box is there any way to fix this?
View 10 Replies
Dec 6, 2006
Im wondering if the LoadVars.SendAndLoad()-function can target a particular frame in a webpage as can the LoadVars.send()-function?
View 2 Replies
Mar 20, 2009
This animation is for a kindergarten course. I have 6 different colored teddy bears on the
floor and the bears are to be placed on the middle shelf in the room, in no particular order. I have the code in place to drag the bears, and they return to their original location if dropped in the wrong area. Everything works, except I can't make the bears stick to the target area. The target area has to be the same for all 6 bears.
View 17 Replies
Jun 14, 2010
I have a movie clip on my stage that has its own timeline with 7 frames, each a keyframe with different content. How would I target a movie clip that appears only on one of these frames within the parent clip?
I'm used to using dot syntax to target clips within clips (eg. parentClip.myClip.onRelease = function(){...), but when I try this with a clip that only appears on one of the frames in the parent clip it doesn't work. Do I need to address that frame specifically? How would I do this? I'm using AS2 in CS3 on a Mac.
View 2 Replies
Feb 5, 2010
I have a swf called anim1.swf acting as a preloder and loading anim2.swf. anim1.swf is attached to a document class called Racine.as. Once anim2.swf is loaded, how can I target the root of anim2.swf?
For example, anim2.swf contains 2 clips called clip1 and clip2. clip1 contains a child called clip1_1. How can I access clip2 from within clip1_1 by using an absolute way (I don't want to use the parent property)?
N.B : a way would be to have a document class attached to anim2.swf, but here there is none.
View 5 Replies
Feb 9, 2010
In this code:
[Code]....
What code and where do I put it to open this link in the same window?
View 4 Replies
Jun 10, 2010
I am trying to target a TLF Textfield within a movieclip from that movieclips custom class, but the class can't find the instance name. When I trace out the child name it comes up with a random instance name, not the instance name I set on the stage. When I try and target it from the movieclip's timeline it works fine. Is there a class I need to include in my custom class, or is this a bug? I would love to move from dynamic text fields to TLF, but this is a big hurdle.
View 10 Replies
Feb 14, 2012
I realise that I need to keep all my code on the main timeline, so now I need some serious help with targeting movieclips and buttons, when I use the target path tool (the little gun sight in the action script panel) it lets me navigate to the thing I want, but when I use it's suggestion it very often doesn't work, and I am left using trial and error to work it out. Ican get stuff to work, but I really have no idea why or how I am doing it, Sorry to be such a N00B, but I really think if I can work this out I am going to get
View 5 Replies
Feb 27, 2012
I want to use getRect for a target that is on the bottom layer of my timeline so that I can detect is an answer has been dropped on a target even if something is covering it. My code at the moment isnt working, anywhere I drop my answer acts as if it is on the target.This is so I can have multiple answers for the one target, the problem I have been having is once a correct answer has been dropped, it then covers the target and causes other answers to not be able to "see" it.
var startX:Number;
var startY:Number;
trace(getRect(target1));
this.ans1.addEventListener(MouseEvent.MOUSE_DOWN, pickMe1);
[code]....
View 5 Replies
Apr 24, 2010
Can i target the second key frame of an empty movieclip which is created by actionscript.as for example:this.createEmptyMovieClip("target_mc",1);I want to write some script on the second keyframe on the target_mc movie clip. Is that possible.
View 1 Replies
Mar 2, 2011
I want to be able to create the following if possible:
Create five words that make up a sentence and they are mixed up in order. So basically I would turn each word into a Movie clip perhaps.
I would then like to assign a target hotspot for each word so that a user can drag the words into the correct order.
Once they are in the correct order they click a button to go to a correct response or incorrect response. Is this possible?
View 1 Replies
Aug 17, 2011
How can create target blank (new page open) button click
View 9 Replies
Jan 22, 2010
I'm looking for an alternative to using:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyFunction);
The problem I am encountering is that eventListener above works fine on its own(stand-alone swf), but when loading an .swf externally into another .swf, the listener fails with the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
How can you target the event listener when loading as an external .swf differently?
View 3 Replies
Mar 3, 2010
I have produced a Flash movieclip, containing a fair few layers, including masked layers, actionscript etc. One of the things it does is allows the user to click and drag a number of movieclips and drop them anywhere within the mc, but if they drop them on specific drop targets then some actionscript (AS2) kicks in, stops the drag object from being draggable again and advances through its frames to basically 'enlarge' the drag object and play a sound to show the user they've hit the right mark. This all works perfectly on its own, or in a browser window etc.
The problem I have is when I try to insert the Flash movie into an Adobe Captivate 4 e-learning package. Things work ok apart from when you drop the dragged object onto a drop target, nothing happens. The actionscript doesn't execute. Would the fact that the movieclip is (probably) sitting within a container (the Captivate e-learning package) be causing the problem? If so, how do I get around this issue?
View 5 Replies
Apr 19, 2010
Ok... I have 2 scenes.... 1st scene is an intro menu with several movie clip symbols (let's call them buttons for all intents and purposes) that gotoAndPlay various sections of the 2nd scene when clicked ... The various buttons on this intro screen point to different frame numbers in the 2nd scene... button1 goes to frame 1 of scene 2... button 2 goes to frame 10 of scene 2.... button 3 goes to frame 20 of scene 2 and so on....
when I click the 1st button, it takes me to the 2nd scene at frame 1 and correctly shows me that page ... (all 2nd scene pages have a navigation bar at the top to access the other 2nd scene pages) ... when I click on a navigation button it takes me to the next page within the 2nd scene that I am looking for and each progresive page works correctly.
[Code]....
View 6 Replies
May 23, 2010
If I use an empty movie clip to load a series of images into,how do I get them to load in the center?The images are all different sizes.I think this is fine, if they loaded with the center of both the target clip and the image aligning.Upper left registration point for the target is not good.
View 10 Replies
Jul 23, 2010
if this is posted elsewhere I searched but could not find topic. I would like to know if there is a way to enlarge the size of the target drop point. Seems the users have to be spot on or the shape snaps back.
Any way to give users a little more wiggle room with target drops?
View 6 Replies
Nov 17, 2010
i wrote an as3 and a simple php page.
whenever i use : URLLoaderDataFormat.TEXT i get all the content of the php file.
when i use the VARIABLES , i get this:
[Code]...
View 3 Replies
Oct 30, 2010
I am trying to make a quiz on metals. I have several elements which i want to fall into multiple target areas (e.g. the target areas are shaded grey in the following swf; metal_mc, nonmetal_mc, metalloid_mc). I can make individuals match to target areas (as there are tutorials for that) but i want each one to be able to slide in to any target area (and someday i want to create a solve button which will then place each element in the correct place). have started all over and have designated only chlorine to move (for the moment) but how do i code it to allow it to fall into any of the grey areas?
var objectoriginalX:Number;var objectoriginalY:Number;chlorine_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);chlorine_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);function
[code].....
View 6 Replies
Sep 29, 2003
On the attached exercise, is it possible to stop further items being dragged onto a target when the target box is full?
View 1 Replies