Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Problems With Referencing A Sound Object From A Loaded Mc



hey all. i have a flash file that has the following code in the first frame of the root layer:

Object.env=this;
// store the micro-sounds in an array
totalSounds=16;
soundArray=new Array();
for (i=0;i<totalSounds;i++) {
s=new Sound();
s.attachSound("s"+i+".mp3");
soundArray[i]=s;
}

essentially i have 16 audio clips that i want to reference at various points later in the movie. everything works fine. the code is working nicely. however, i have to ultimately stuff this mc into a shell mc - the shell mc is present when the user enters the page, and when they roll over it, the main mc is pulled into the shell mc like this:

loadMovieNum(movie,1);

when i do this, none of the sounds work. i know it doesnt have to do with root references, because whenever i make a reference to the sound, i do so like this: Object.env.soundArray[x].start()

does anyone know what the problem is? help!

Cheers
j



FlashKit > Flash Help > Flash ActionScript
Posted on: 10-25-2004, 02:16 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Referencing .TextField Object From A Loaded Movie?
From my main movie, I'm loading another movie that creates a text field using the createTextField command.  When I try to format the text field it will not format for some reason.  I think it's because of the way I have it referencing the object and the depth level that I have assigned it.  The textFields are created to display links loaded from a text file.  I'm creating a textFile for each link and assigning each link to it's individual depth level.  My guess is that's what causing the problem, but I don't know how to work around that.  Any suggestions?  Thanks!

height=(150-(10*totalAds))/totalAds


for (var i=1;i<=totalAds;i++){
    _root.createTextField("link_"+i,0+i,-10,height*i,50,10);
    _root["link_"+i].autoSize=true;
    _root["link_"+i].html=true;
    _root["link_"+i].htmlText=ad(i);  // was displaying italics so I changed my array to () for display purposes.
    
    linkFormat=new TextFormat();
    
    linkFormat.url="asfunction:sendURL,"+i;
    linkFormat.underline=true;
    linkFormat.color=0x000099;
    linkFormat.target="_blank";
    linkFormat.font="arial";
    linkFormat.size=12;
    linkFormat.bullet=true;
    
    _root["link_"+i].setTextFormat(linkFormat);
}
stop();

Referencing Sound Object Attached To A Movie Clip
Hey, I'm trying to reference a Sound object that is attached to a movie clip on the root level. I am trying to reference it from a button embedded in a movie clip. I can't get it to work from the button, even though I can get it to work from the root level. Here is the code I'm using:

Root level frame code:

createEmptyMovieClip ("movie_mc", 1);
var driveSound:Sound = new Sound("movie_mc");
driveSound.attachSound("mySound");
driveSound.start(0,999);
driveSound.setVolume(80);

Button code for button embedded in a movie clip:

on(release){
_parent.driveSound.stop();
_root.driveSound.stop();
driveSound.stop();
_parent.movie_mc.driveSound.stop();
_root.movie_mc.driveSound.stop();
movie_mc.driveSound.stop();
}

As you can see, I've tried to reference the sound clip in every way I can think to try from the button and nothing works. Please help! Thank you!

AS2 Sound Object Loaded Into AS3
Hi Everyone,

I have an AS2 .swf that I'm loading into an AS3 file. The AS2 .swf uses the old AS2 Sound Object, which of course works fine when I play the AS2 .swf directly, but when I load it into the AS3 file the sound stops working. Everything else in the AS2 .swf works fine. I'm loading the AS2 .swf with this:


Code:
// Load AS2 .swf into AS3 holder
var myMC = new Loader();
addChild(myMC)
myMC.load(new URLRequest("AS2.swf"));


Is it possible to play sounds with an AS2 .swf that is loaded into an AS3 file? If neccesary I can rebuild all of the sound functionality inside of AS3, but it would save me a lot of time if I can create some sort of sound object in AS3 and connect it to the sound object in the AS2 swf.

Thanks for any insight!

AS2 Sound Object Loaded Into AS3
Hi Everyone,

I have an AS2 .swf that I'm loading into an AS3 file. The AS2 .swf uses the old AS2 Sound Object, which of course works fine when I play the AS2 .swf directly, but when I load it into the AS3 file the sound stops working. Everything else in the AS2 .swf works fine. I'm loading the AS2 .swf with this:


Code:
// Load AS2 .swf into AS3 holder
var myMC = new Loader();
addChild(myMC)
myMC.load(new URLRequest("AS2.swf"));
Is it possible to play sounds with an AS2 .swf that is loaded into an AS3 file? If neccesary I can rebuild all of the sound functionality inside of AS3, but it would save me a lot of time if I can create some sort of sound object in AS3 and connect it to the sound object in the AS2 swf.

Thanks for any insight!

Using Sound() Object In Loaded Swf
I have a swf that gets loaded using loadMovie(). In a frame of the nested swf I have this script:

soundInst = new Sound();
soundInst.attachSound("sound_instance");
soundInst.start();

The sound file linkage is activated for use in action scripts and has the instance name "sound_instance". When I preview just this swf by itself, the sound plays as expected when the appropriate frame is hit. However when I preview the main movie that loads this swf, the sound object does not work in the nested swf.

any help is appreciated.

Target Sound Object From Loaded .swf
Here's a fun one...

I have a long movie/presentation using an attached mc as an soundtrack...

frame 1 script:

attachMovie("bgloop", "daloop", 2);
mainlp = new Sound("daloop");
mainlp.start(0,50);
mainlp.setVolume(80);

now this works fine...the soundtrack plays independently of anything else going on...

now these presentations are 800x600 and I need to integrate them into another movie that is 640x480 (for a video)...so I'm calling it into a mc instance "sym" in the 640x480 movie

frame 1 script:

stop();
loadMovie("800x600.swf", "sym");

...then resizing with

onClipEvent(data){
this._xscale=80;
this._yscale=80;
}


ok...loads, scales...music plays but no control...it seems to be ignoring the sound object...

This appears to be a targeting issue, but I've tried all manner of targeting from the main timeline and it's not responding...I'm chasing my tail a bit here so if anyone help with the right syntax I'd appreciate it...

thanks in advance

Sound Object In Loaded Movie Won't Play
For simple background sound with control, I have one movie with a volume slider controlling a sound object that I am loading into a second movie (Level1), but the sound doesn't play in that second "main" movie. However, it plays fine in the volume control swf (I did it as a separate movie because the main movie has multiple scenes - presentation-style - and the sound object would keep layering upon itself with with each new scene). Is there something I'm missing? Do I need something more than just a "loadMovie" to ensure that the sound is also played? I'm a limited-experience action-scripter at this point, so any insight would be great.

Sound Object Doesnt Work When Loaded Into Another SWF
Okay,
So I have a quiz where a sound plays when someone gets the answer right or wrong. It works like a champ when loaded by itself, but if I load the quiz into another movie, it doesn work. Any ideas as to whats going on?
Thanks in Advance.
Nate

Referencing An Object
I'm trying to identify which Object should be called by passing an arguement to a function


ActionScript Code:
function myAdd(imageUrl,xPos,yPos,myTransition:String) {

            var myImage:LoadObject=new LoadObject(imageUrl);
            var ExpandAPrimary:Object={scaleX:1,scaleY:1,time:.5,transition:"easeOutElastic"};
            var mytest:Object = ExpandAPrimary;
            trace("your test var is: "+ mytest);
            myImage.scaleX=0;
            myImage.scaleY=0;
            myImage.x=xPos;
            myImage.y=yPos;
            Tweener.addTween(myImage,  {base:mytest});
            addChild(myImage);
        }


When i try and replace


ActionScript Code:
var mytest:Object = ExpandAPrimary;
with the arguement myTransition:String


i get:

ReferenceError: Error #1069: Property base not found on String and there is no default value.





the initial call is


ActionScript Code:
var myclock1:ObjectTimer = new ObjectTimer(.5, 'nut1.png', 0, 50, 'ExpandAPrimary');

Referencing From Object
Hi!

Can anyone explain, how can I reference to a timeline from the object not using _root?! Is it posible?

For example:


ActionScript Code:
var someListener:Object = new Object();
someListener.onMouseMove = function() {
    trace("_root "+_root); //_root _level0
    trace("this "+this);   //this [object Object]
};
Mouse.addListener(someListener);

Referencing An Object
I'm not sure if this is good scripting practice...anyhow... I have a constructor function that creates an object and then attaches a movie onto the stage that is referenced within the original object. Now, if I attach a onPress function to the movie, is there any way to reference the very very first object? I think I am seeing a hierarchy that really doesnt exist...
An example would be:

Code:
MainObject = function(){
this.ref = _root.attachMovie("mc","my_mc",1)
this.message = "hi!"
this.ref.onPress = function(){
trace(?***?.message)}
}
Is there anything I can put in ?***? that would reference the original object and display the original objects message? Sorry if this is a dumb quesion!

AS2 Class Object Referencing
Okay, so I have an object which is derived from mty DrawGrid3d class which works lovely. The draw3d class extends the movie clip class and has a constructor methos which believe it or not builds a 3d grid. Now I cant seem to be able to refer to the objects properties in any way. for example the code below traces out 'undefined'.
Any ideas?
Cheers


Code:
my_grid3d=new DrawGrid3D(_root,130,100,16,16,12,18,176,5.9,0xC5D7FE,0xFFFFFF)


trace("GRID IS:"+my_grid3d._x)

Referencing An Object In An Array
This is practically spam and I appologize. I think I can better articulate my problem now- and thought a new post would help.

If _inventory[2] = "a string" that is my Event.target I could:

trace(Event.target)

And it would trace "string".

trace(Event.target == "a string")

And it would trace true.

Same is true for:

trace(Event.target == _inventory[2])

Now, if I replace _inventory[2] with an instance of the class string_mc and it is my Event.target I can still:

trace(Event.target)

But now I get:

[object string_mc]

And I can still:

trace(Event.target == _inventory[2])

And get a true.

But if I try the equivelent of trace(Event.target == "string") I cannot make it work.

trace(Event.target == [object string_mc]) gets a syntax error.
trace(Event.target == object string_mc) doesn't work.
trace(Event.target == string_mc) comes back false.

Using === instead of == doesn't work either.

So, what do I put between the == and the closing paren to make this work?

Object Referencing Question
if i've got an MC on the main stage named "mainContact", and this mc has the code:


ActionScript Code:
onClipEvent( load )
{
    phpVars = new loadVars();
    phpVars.load( "pages/contact.php" );
    phpVars.onLoad = function( success )   
    {
        if( success )
        {
            doneLoad = "true";
        }
    }
}

i'm wanting to check from within "mainContact" if doneLoad == true, but since it's in the phpVars.onLoad function, doneLoad is registered under phpVars. how can i make doneLoad be referenced under mainContact without using absolute referecing as in, "mainContact.doneLoad = true;"?

Variable Object Referencing
Hello, I just stumbled across your forums today looking for an answer to my question on Google.

I am in no way very knowledgable with ActionScript, so this might be very simple and I am looking in all of the wrong places... but basically here is my issue:

Instead of accessing an objects attributes like this, _level0.thumbnails.thumbnail0._width = 500;

I want to be able to access it with _level0.thumbnails. (this.id) ._width = 500;

where as (this.id) is a variable that could be equal to "thumbnail0" or "thumbnail99" depending on which object gets clicked. I have everything working to if I hardcode thumbnail0 it works fine, and this.id does get set to whatever thumbnail I click's "thumbnail" + ID

... any help?

Array Referencing Object
I have created an object that I wish to put into an array. I will have several objects with different commands that are going to be in this array. I would like to specifically reference the different variables in the objects. I thought I had everything going but when I traced the array the different variables are listed as undefined. How do I specifically reference a variable of an object that is placed in an array?

var MyObj = new Object();
MyObj.Title = "CTRLA.jpg";
MyObj.Command1 = "yeah";
MyOBJ.Command2 = "Nah";



objective = new Array();
objective[0] = MyObj;
trace (objective);
for(i =0; i < objective.length; i++){
trace(objective[0].Command1);
}

Thanks,
Sam

Dynamic Object Referencing
Hi everyone,

i've built a accordeon like movie clip to present search form results for a web site. The results are "fed" into flash by .NET webservices and the "accordeon" itself is dynamic.

My question is i want to add a button to show further detail on each line of results, but i don't seem to be getting the button to be clickable inside the individual lines.

this is the code i use to build the "accordeon" display:


ActionScript Code:
// _y position
var y = 0;
// _depth
var d = 0;
 
for (i = 0; i < 13; i++) {
linesArray[i] = i;
d = d + 1;
y = y + 20;
// check for empty (undefined) results and stop adding lines
if (theResults.Collection[i].Referencia == undefined) {
i = numRegistos;
return;
} else {
attachMovie("acordeonLine", "line" + i, d);
// fill the line text boxes
txtRef = myresults.ref;
txtName = myresults.name;
}
// use the line it self as a button to slide open and show photos
this["line"+i].onRelease = function{
trace("HEY! YOU CLICKED ME!");
}
}


inside the each "accordeonLine" mc there's a button called btDetails i'm trying to use by adding this (or similar) code inside the for loop that adds line to the accordeon:


ActionScript Code:
this["line"+i].btDetails.onRelease = function{
trace("HEY! YOU CLICKED ME!");
}


the path this["line"+i].btDetails evaluates as undefined. its like its not even there.

i've tried other "tricks" but i simply can't get the click to work.

Any ideas?

Sub MC Referencing From Dynamically Named Object
Hello All!

Here's what I'm trying to do. I have a base movie clip with 2 inner movie clips inside it. I am dynamically setting the color of one of the inner movies. Here is my code

code:
sqColor = new Color(_root["square" + j].filler);
sqColor.setRGB(thisColor);


This code sets the color of a movie labeled filler within my "square"+j MC.

Accessing the dynamic variable name through the _root array works fine. HOWEVER! I cannot use the _root array. I am using the loadMovie function in another MC to call this MC. So the _root array is no longer the same and it doesn't work.

Is there another way to do this? I've tried to access the "square"+j object with out the _root reference, but no luck.

Any suggestions? THANKS IN ADVANCE!!

AttachMovieClip - Referencing A Dyamic Object
I have begun using the attachMovieClip() recently to dynamically assign objects to movieclips. Up until now it has been excellent, and is perfect for assigning various enemy sprites to instances of a movieclip etc.

At the moment though i am having problems getting messages through to the 'attached' clip to tell it to stop() or play() etc. The info is a little unclear on this topic, but it seems that if i use code like:

dummy.attachMovie(cat, cat add i, 1);

and then say dummy.stop(), that it only targets the original 'dummy' clip and not the 'cat' movie i have attached. I have tried referencing it with the assigned name, but i must be missing something or doing it wrong, any ideas??

thanks!!

Referencing Object Using Variable Syntax
I'm having trouble referencing an object using a variable in Flash MX.
In this example, I'm dynamically loading jpegs and need to test that they have finished loading.
The img var contains the url of the image to load.


On the first frame:

for(i=0; i<number_of_images; i++)
{
//duplicate the holder
duplicateMovieClip(my_movie.holder, i, i);

//create reference for the img to load
img_to_load = "my_movie.holder." + i;

//load image into the duplicated movie
img_to_load.loadMovie(img_url);
}

On another frame:
if(img_to_load.getBytesTotal() >= img_to_load.getBytesLoaded() )
{
//image has loaded
}else{
//image still loading
}


My problem is that img_to_load is a variable that returns a string and not an object - what do I need to do?

Thanks in advance

[Help] Classes Object Ownership And Referencing
I want to access methods and data of an object A from another object B - which was created in the object A. However, using the _parent property doesn't work. I need an explanation why doesn't it work.

To futher clarify my question, I have a problem when using classes in this way:

code:
class MyClass
{
var Some_Data:MyOtherClass;

function MyClass
{
Some_Data=new MyOtherClass();
}

function DoSomething():Void
{
trace("Did something.");
}
}

class MyOtherClass
{
function MyOtherClass
{
SomeProcedure();
}
function SomeProcedure:Void
{
_parent.DoSomething();
}
}


When I create an instance of the MyClass there is no output. I need an explanation why this is so.

Edited: Have corrected some mistakes in this thread

Referencing An Object's Variables In An Array?
I have created an object that I wish to put into an array. I will have several objects with different commands that are going to be in this array. I would like to specifically reference the different variables in the objects. I thought I had everything going but when I traced the array the different variables are listed as undefined. How do I specifically reference a variable of an object that is placed in an array?

var MyObj = new Object();
MyObj.Title = "CTRLA.jpg";
MyObj.Command1 = "yeah";
MyOBJ.Command2 = "Nah";



objective = new Array();
objective[0] = MyObj;
trace (objective);
for(i =0; i < objective.length; i++){
trace(objective[0].Command1);
}

Thanks,
Sam

Timeline Control & Object Referencing
Hi,

I'm wondering what the proper ActionScript is to control a timeline within an event handler function. In an xml.onLoad function I want to send the main playhead to a certain frame based on the content of the XML. The only way I have found to do this is using _root.gotoAndPlay within the {} of the onLoad function; using gotoAndPlay, this.gotoAndPlay, this._parent.gotoAndPlay etc. doesn't work. These would of course work if they weren't within the onLoad function -- thus something about being within an object function changes positioning/referencing of movie clips and timeline control.

_root is a workaround and it's not perfect. any ideas on how to properly control timelines from within functions such as xml.onLoad?

Thanks in advance!

[CS3/AS2.0] Need Some Help... (AS Tween/object Referencing Issue)
Hey guys,

Im trying to create a tween that will animate in any page that i give it. At the moment i have this.


PHP Code:



function pageTransitionIn(i:Number):Void {
    new Tween(["big"+i+"_mc"][mask_mc],"_x",Regular.easeInOut,["big"+i+"_mc"][mask_mc]._x,-10,1,true);        
}
function pageTransitionOut():Void {
    new Tween(["big"+i+"_mc"][mask_mc],"_x",Regular.easeInOut,-10, 700,1,true);        
}

pageTransitionIn(1);




My problem is that this code doesn't work, however when i try a specific big1_mc it does:


PHP Code:



function pageTransitionIn():Void {
    new Tween(big1_mc.mask_mc,"_x",Regular.easeInOut,big1_mc.mask_mc._x,-10,1,true);        
}
function pageTransitionOut():Void {
    new Tween(big1_mc.mask_mc,"_x",Regular.easeInOut,-10, 700,1,true);        
}




So im obviously just referring to the object wrong. Does anybody know the correct way to refer to big1_mc.mask_mc with i in place of the number so that i can use it for multiple pages? I've tried this and _root but i can't get it working.

Thanks

[F8]Path Independant Object Referencing
Is it possible to reference objects in flash independent of their path. I am using flash as an interface for an external system. The external system used channel messages (1-10000) that I wish to tie to buttons. The buttons may exist on any form within a movie so connecting each incoming channel message the appropriate button in code will be very time consuming. If I could just address the appropriate button via it alias irrespective of its path then I could simply alias my buttons B1 - B10000 and use a simple function to connect the channel message to the button. Any suggestions?

Thanks in Advance

Referencing An Object Created By A Function
Why can't I reference an object created by a function if it has been added to the stage?

For example, I write a function that creates a text field and adds it to the stage:


ActionScript Code:
function makeText():void
{
    var myText:TextField = new TextField();
    addChild(myText);
}

Now in another function I want to say myText.text = "Hello!", but I get the error "1120: Access of undefined property myText.".

I know it has to do with scope, but how do you access something that's been added to the stage outside of the function that created it?

Button Transparency And Referencing FLA Object From AS3.
I'm using the following graphic and animating the mouth when clicked. Problem is I don't want the CLICK event to dispatch when the transparency is clicked. I know using the flash file I can draw a graphic the shape of my image and place it behind the image and dispatch the click event for the drawn shape, but here's my question.

Is there a better way of doing this for buttons with transparencies?

If not how do reference a drawn graphic in my fla file from my as3 file?

Thanks

Flash Mx Object Referencing Problem
hi there:

I have
loadMovie("bridge1.jpg",_root.pict_dropzone);
in a.swf

this works fine. when a.swf tested alone.

but when b.swf uses code to load a.swf onto b's screen at runtime the line of code above doesn't work

I guess _root.pict_dropzone is the problem and has to be changed to this._root.pictdropzone
where this refers to a.swf

what's the correct syntax for this?

Referencing An Object Inside A Class
and I'm trying to add an event listener and a function to the class, but I keep getting errors of undefined,
I tried just about everthing to be able to refference obj0 can anyone please help?

objGroup.obj0.addEventListener(MouseEvent.CLICK, onClick)
private function onClick (event:MouseEvent):void{

trace ("Click");

}

any help or advice will be greatly appreciated sincerely newwave
---------------this is my complete code - above code-------------feel free to use as you wish----------------------







Attach Code

package {
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import org.papervision3d.core.proto.MaterialObject3D;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.view.BasicView;

public class pv3dMyRotation2 extends BasicView {

private static const ORBITAL_RADIUS:Number = 300;
private var angle:Number = 0;
private var obj0:Sphere;
private var obj1:Sphere;
private var obj2:Sphere;
private var obj3:Sphere;
private var obj4:Sphere;
private var obj5:Sphere;
private var obj6:Sphere;
private var obj7:Sphere;
private var objGroup:DisplayObject3D;

public function pv3dMyRotation2() {
super(0, 0, true, false);
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
init3D();
createScene();
startRendering();
}

private function init3D():void {

camera.x = -200;
camera.y = 0;
camera.z = 0;
}

private function createScene():void {

var light:PointLight3D = new PointLight3D(true);
light.x = 400;
light.y = 1000;
light.z = -400;

var M1:MaterialObject3D = new FlatShadeMaterial(light, 0xFF0000, 0xFFCC99);

for(var i=0; i<8; i++) {
this['obj'+i] = new Sphere(M1, 50, 10, 10);
this['obj'+i].x = ORBITAL_RADIUS * Math.cos(angle);
this['obj'+i].z = ORBITAL_RADIUS * Math.sin(angle);
angle += (360 / 8) * Math.PI / 180;
}

objGroup = new DisplayObject3D();
objGroup.addChild(obj0);
objGroup.addChild(obj1);
objGroup.addChild(obj2);
objGroup.addChild(obj3);
objGroup.addChild(obj4);
objGroup.addChild(obj5);
objGroup.addChild(obj6);
objGroup.addChild(obj7);

scene.addChild(objGroup);
scene.addChild(light);

}

override protected function onRenderTick(event:Event=null):void {
objGroup.yaw(1);
super.onRenderTick(event);
}
}
}

























Edited: 02/01/2009 at 08:58:22 PM by newwaveboats

_root Replacement For AS3 For Object Referencing
Hello,

I am having some problems with accessing objects on the main timeline.

I am calling this function registerMenuButtons() from a function getDimensions() in AS3:

function getDimensions():void {
registerMenuButtons();
}

and registerMenuButtons accesses a textfield in a movieclip on the main timeline:

function registerMenuButtons():void {
graphics_gr.start_txt.text = "start"
}
however it seems to be a null object reference, text does not change.

In AS 2 I would have used _root to reference graphics_gr.start_txt.text. However I understand that it does not exist anymore. So I defined a variable called ref = this.root, and when I trace ref.graphics_gr it gives me "[object] point1. However this does not apply for start_txt, and instead when i try ref.graphics_gr.start_txt it gives me a null reference.

Is there any way to use a similar method like _root in AS2 to access an MC? Really don't know what's the problem, and I am not using any custom Document Class at the moment. Thanks!

Two Object Referencing Same Member Array?
I'm working a neural network project and my basic architecture is this:
1. Neurons
2. Neuron Layer (basically an array of neurons)
3. Neural Network (basically an array of Neuron Layers)

When I reference the first Neuron Layer's array.length it gives me the total number of neurons in the network rather than what the number of neurons in the first layer should be. The same thing happens for the second layer and each subsequent layer should there happen to be more. I've added trace statements to the Neuron Layer constructor that tells me a neuron has been added and I've also added a trace statement after the first neuron layer is added and the second neuron layer and I get the correct number of "neuron added" statements before the "first layer added" statement and the correct number for the second layer as well. This pretty much assures me that the actual number of neurons in each layer is correct when the first layer is created but somehow the number of neurons in the first layer and subsequent layers is actually becoming the number of neurons total. The only thing I can figure out is that somehow, the first neuron layer object is referencing the same neuron array member as the second neuron layer object. Is this possibly what is happening?

Dynamic Referencing With Color Object
Hello, need help. I am building a game where the first five numbers of 20 randomly selected numbers are colored differently from the rest. The code I'm using looks like this:

function coloron() {
for (i=0; i<=80; i++) {
if (x == i) {
newnumcolor = new Color(_root.ball_movies_all["BallMovie"+i]);
newnumcolor.setRGB(0x660099);
backcoloron();
}
}
}

I am using dynamic referencing to setRGB of the nested movie clip. It sounds good in theory, however, this does not work. If I target the clip above the one I want, "ball_movies_all" the setRGB works perfectly fine. But when I target the dynamically referenced clip, the setRGB does not work. Any ideas/workarounds would be greatly appreciated.
~m

Referencing A MovieClip Object From Within A Function
I have a movie clip that loads a file. If the file contains a certain value I want to call a function and send it "this" (a reference to this movieClip object). But "this" does not refer to the object, instead it seems to be linked to the values the file has loaded.

-----------------------------------------------------------------
function successFunc(success) {

if(success) {

if (myLoad.featured == "yes"){

_root.registerMeFeatured( this );

}

}

}
------------------------------------------------------------------

The above is what I have and it sends the contents of the file rather than a reference to the movie clip (which is what i would like).

-----------------------------------------------------------------

_root.registerMeFeatured( this );

------------------------------------------------------------------

The above, when used outside of the function will work properly and send the object as I would like. How can I make this work within the function? Thanks in advance.

Referencing Loaded SWF?
I have made a website (see http://www.polysteelsoutheast.com , if you want t get an idea of it) where the menu is a swf file. Currently, its a different menu on each separate swf - each page has its own swf, which is an awful way to do the menu because whenever you need to update the menu its a ton of work). Therefore, I am simply trying to make a menu that looks almost exactly the same with a little square that goes over whichever menu item corresponds to the currently opened swf file and then have the correct location for that square in the "menu" swf file rather than in the individual swfs for each page. I loaded the menu into one of the pages, and I can see that its working partially (when I add a trace after the "current frame" code in the menu swf, it shows up in the actual swf) , but it will not take the x,y,h, and w information I have.

Here is what is on the menu swf:

//mb (mb stands for menu block, which is the small square I want over the particular menu item that reflects the file that this menu is currently located into)//

this.mb_btn.onEnterFrame = function() {
cX = this._x;
cY = this._y;
cW = this._width;
cH = this._height;
difY = cY-targY;
difX = cX-targX;
difW = cW-targW;
difH = cH-targH;
setProperty(this, _x, cX-(difX/5));
setProperty(this, _y, cY-(difY/5));
setProperty(this, _width, cW-(difW/5));
setProperty(this, _height, cH-(difH/5));
}

//------------when the current file is building green--------------//
if (_root.currentFrame=="buildinggreen"){
//change position of mb//
targX = 653.1;
targY = 125;
targW = 21.9;
targH = 24.1;
trace("building green page")


}

//------------when the current file is financing--------------//
if (_root.currentFrame=="financing"){
//change position of mb//
targX = 582.1;
targY = 125;
targW = 70;
targH = 24.1;

}

HERE IS THE CODE I HAVE ON THE ACTUAL SWF THAT THE MENU IS LOADED INTO:

_root.currentFrame="buildinggreen";
loadMovie("polysteelmenu.swf", "menuloader_mc");

But whenever I actually try it out, the only thing that works is the trace. The mb_btn just stays wherever I've placed it originally in the menu file.

All I need to know is what I am referencing incorrectly! Does anyone know?

Thanks!
Christy

NoobAlert: Dynamically-created Object Referencing
Long-time Flash user, new Actionscript student, so please forgive my forum invasion with what is probably a simple-answer type of question.

If I drop instances directly on the stage, I can access and modify their attributes and built-in functions just fine by referring to the instance name I specified.

However, if I use the constructor to make and position a group of objects at runtime, later attempts to reference or modify those objects by name generate an "Access of undefined property ..." error. I can modify the names in a loop within the constructor and trace their names to verify, but no luck actually accessing them. Am I missing something? (Other than a couple of months of reading, studying, implementing, and experimenting)

Thanks for any direction!

Referencing Other Object Classes In A Class Definition
Here's want I want to do.
I have a ball class and paddle class. I want to put a hitTestObject statement in the ball class that references the paddle class. I need the ball class to perform the same function whenever it hits an instance of the paddle class.
Can I achieve this affect with just these two classes, or do I need to write a third class to handle collisions between the two classes?

Why doesn't this work?
ball class:

ActionScript Code:
package
{
  import paddle
  import flash.display.MovieClip
  import flash.events.Event
  public class ball extends MovieClip
  {
    public var xmov:Number = 5
    public var ymov:Number = 5
    public function ball():void
    {
      stage.addEventListener(Event.ENTER_FRAME, enterframe)
    }
    public function enterframe(event:Event):void
    {
      if(this.hitTestObject(paddle))
      {
        ymov *= -1
      }
    }
  }
}

Referencing A Loaded Movie
Can anyone help?

I have loaded a movie clip with the command;

loadMovie ("../aspect/aspect_ratio.swf", "_parent._parent.main_drop");

which works fine (I have a somewhat complicated movie going on!!). I now want to tell that movie to goto a frame from the same bit of code. I tried

tellTarget ("_parent._parent.main_drop") {
gotoAndPlay ("two");
}
but obviously this is not right.

Can anyone point me in the right direction.
Cheers
Nick

Referencing A Loaded Movie
hi

someone at work asked me about this & i have no idea

he's got library.swf with 4 movie clips that have the linkage of 'export this symbol'

there are buttons in library.swf to load in the linked movie clips, e.g.

placeHolder.attachMovie("circle", "myCircle", 2);
placeHolder.myCircle._x = -40;
placeHolder.myCircle._y = 40;

right...

library.swf is loaded into the 'placeholder' movie clip in main.swf

placeHolder.loadMovie("library.swf");

can he use any variation on the above attachMovie() code to trigger the attachMovie inside library.swf using a button inside main.swf (if that makes sense)

as i see it, the complication arises through the fact that library.swf has no instance name inside main.swf - is there any way to give a loaded movie an instance name?

i've suggested rearranging everything to use levels but it would be a lot easier not to...

any ideas anybody?...

thanks for your help

Referencing A Loaded Movie
I have a seperate movie that I load into my main movie and basically use that as a navigation system. I'm trying to reference a particular scene within the main movie from within the loaded navigation movie. I'm having trouble with the referencing. I have no problem referencing a Frame Label on the main timeline, but for some reason it won't go to a scene. I'm probably messing something up with my code, but any help would greatly be appreciated!!

Thanks!

[F8] Referencing Loaded Images
I have created a flash photo-gallery that is driven by XML database (none of the images are imbedded in the flash). I have created an image pre-loader with the help of some of the people here that works great. Now that I have the images loaded, I am trying to access/place the loaded images on the stage when called for in frame 2.

I have the movie split over two frames (one for the loader and the next for the gallery). The images get loaded in frame 1 and in frame 2, I need to access the loaded images for the gallery. When I run the SWF in a slower download simulation speed (56k), I see the pre-loader working on frame1. When the pre-loader is done, I tell it to go to frame 2 which is the gallery. Here however, I see that the images get downloaded again so there's a delay after the pre-loader before the first image is displayed.

I think that the problem is in my frame2 code where I have the following:

Code:
template1_imageHolder1_mc.loadMovie(movie1);
That "loads" movie1 again even though it was just loaded in frame1.

What is the best way to get aroud this issue? Is it to use loadVariables and not loadMovie because the image is already loaded? I have read about Check for Loaded Data and using the use XML.onLoad() function but it isn't very fleshed out unfortunately.

Thanks.
B

Referencing Loaded Clips
I have an index file which loads he navigation and home page files like this

//create home page holder
this.createEmptyMovieClip ("rotateClip", this.getNextHighestDepth ());
//load homepage
rotateClip.loadMovie ("home.swf", [GET]);
//create nav holder
this.createEmptyMovieClip ("navClip", this.getNextHighestDepth ());
//load navigation
navClip.loadMovie("navigation.swf");
I then load the services page replacing the home page by referencing rotateClip from the loaded nav file attaching this code to the services button

on (release) {
_root.rotateClip.loadMovie("services.swf");
}

The services page has sub sections which I load in the same way as the home page. They load fine once services page is loaded like so

on (release) {
_root.rotateClip.loadMovie.servHolder.loadMovie("servMgmt_mc.swf);


}

servHolder is to services what rotateClip is to the index page.

How can I get it to work if the user hasn't loaded the services page?
when I put this line before it or on a preceding frame

_root.rotateClip.loadMovie("services.swf") to make sure services gets loaded the servHolder doesn't load anything

Referencing The Stage From A Loaded Swf
I am converting my website, which has a liquid interface, to as3 but I am still learning and I have a problem.

I have child.swf that I load dynamically into parent.swf. When I run that I get:


Quote:




TypeError: Error #1009: Cannot access a property or method of a null object reference.




Through trial and error I found that the null object is the child.swf trying to reference the stage at several places such as stage.stageWidth. If I comment all of them out it runs error free, but it also doesn't do anything. I have tried replacing the first 'stage' with other things such as 'root.stageWidth' but no dice.

I was also wonder how I can have a button in child.swf unload itself from the parent.swf?

Referencing Flash Object From Javascript Using AC_RunActiveContent.js Solution
I apologize for any ignorance in this post, as I am a .NET developer, not a flash developer. I am using a swf object to play FLV movies and am trying to apply the RunActiveConent.js solution to it, recommended by Adobe. The solution works fine and the player loads and runs the FLV movie and the "click to activate" is nowhere to be found.

However, I reference the flash object through javascript to call actionscript functions that cause the FLV movie to jump to the specified point. The details of the actionscript are not important - I am unable to reference the flash object through javascript to call the actionscript - any thoughts on how to reference the flash object through the document model?

thanks

Simple Problem - Referencing Object Array Properties
Sure this is dead straightforward. My flash creates a bunch of objects with x and y properties. These all get pushed into an array and then my .NET aspx page gets the array as an argument. This seems to be an ArrayList (although the documentation seemed to say it would be a HashTable) of ASObjects. How do I then refereence the x and y properties of the ASObject - is this what is now referred to as a Key?

Referencing Button Inside A Loaded SWF
Hey everyone,

I'm completely new to ActionScript and have been learning what I can in bits and pieces today. I'll try to keep my problem simple. In my main movie, I have a button that loads a second swf (small window) file into the main movie. The second file "flies" in from the bottom using motion easing. I've accomplished everything fine so far except that when I press close on the popup, it abruptly disappears.

I thought I could use yoyo() to reverse the animation when close is clicked to hide the popup off screen until I need it again. I just don't know how I'm supposed to reference the close button in the second movie from the first one.

The button in the second movie instance is Exit while its class is ExitButton. To accomplish what I'm trying to do I should set up an event listener in the main movie and remove the one from the second correct?

ActionScript Code:
wbutton.buttonMode=true;
wbutton.addEventListener(MouseEvent.CLICK,onClick);
function onClick(event:MouseEvent):void {
    var box:Loader= new Loader();
    var urlrHome:URLRequest = new URLRequest("popup.swf")
    addChild(box);
    var myTween:Tween = new Tween(this, "y",Exponential.easeOut, 600, 0, 1, true)
    box.load(urlrHome);
}

Referencing One Of A Series Of Loaded Clips
Here's an example of a series of MovieClips being loaded into a container clip:

Code:
for(var i:int=0;i<10;i++){
var dotClip:Dot = new Dot();
dotClip.y = i*dotClip.height + 5;
holder1.addChild(dotClip);
}
In attempting to affect one particular loaded clip, I've got this:

Code:
var dots:Array = new Array();
for(var i:int=0;i<10;i++){
var dotClip:Dot = new Dot();
dotClip.y = i*dotClip.height + 5;
holder1.addChild(dotClip);
dots.push(dotClip);
}
dots[5].x = -25;
My question is, is there a way to refer to that sixth dot without having to create an array and push all the dots into it? I'm trying to migrate from the AS2 attachMovie() . Many thanks!

Referencing Movie Clip Not Same When SWF Loaded Into SWF
This code is based on the _droptarget info in the Actionscript 2.0 language reference. It works fine by itself but breaks when the SWF is loaded into another SWF. Note that I uses the _lockroot property to keep the _root of the loaded clip.

I've isolated the problem to the "if" condition. The player doesn't seem to recognize the equivalence of the names. But when debugging with Trace, the names are identical.

The desired result is to have the drag object snap to the target object when dropped on the target but snap back to its origin if not on target. It works in 6, but the drag object snaps back to its origin 7 - as if it was not dropped on the target object.









Attach Code

this._lockroot = true;
origX = garbage_mc._x;
origY = garbage_mc._y;
targX = trashcan_mc._x;
targY = trashcan_mc._y;
garbage_mc.onPress = function() {
this.startDrag();
};
garbage_mc.onRelease = function() {
this.stopDrag();
if (eval(this._droptarget) == trashcan_mc) {
this._x = targX;
this._y = targY;
} else {
this._x = origX;
this._y = origY;
}
};

























Edited: 11/10/2006 at 07:07:59 AM by raylaur

Referencing BitmapData Loaded With MovieClipLoader()
The starting point is that I load an external PNG file into an open SWF application with the following code:
---------------------------------------
var loadListener:Object = new Object();
loadListener.onLoadInit = function():Void {
//do certain actions - not relevant for my question
};
var pngLoader:MovieClipLoader = new MovieClipLoader();

pngLoader.addListener(loadListener);

var mc1:MovieClip = this.createEmptyMovieClip("mc1", this.getNextHighestDepth());

pngLoader.loadClip("http://memetic-tv.net/temp/flower02.png", mc1);
---------------------------------------

That works fine. The problem is how can I later reference to 'flower02.png'
as BitmapData which is loaded as a movieClip into the movieClip 'mc1' to execute certain BitmapData methods like in particular 'copyPixels()'?

I'm aware that I could use:
---------------------------------------
import flash.display.BitmapData;

var libId:String = "flower";
var flowerBmp:BitmapData = BitmapData.loadBitmap(libId);
---------------------------------------
In this way I could reference my BitmapData by its variable identifier 'flowerBmp'. But this would require that my 'flower02.png' is already in the library which is not possible for my purpose.

For any work-arounds and clues I would be very grateful.

thanx

Referencing Variables In A Loaded Movie
Hi,
I'm playing with a Flash library in php called Ming, but it should work much the same as files made in Flash. I also have Flash at my disposal. I'm limited to an older version of Ming, and I think Actionscript 1.0, which doesn't help matters.
When I use LoadMovieNum to load a 'normal' movie (made in Flash MX 04, not generated through Ming) into level 1, it works and shows up fine.
When I try to remove it, however, it doesn't want to know. I'm using UnloadMovieNum(1), which I thought should work.
The second problem I'm having is that I was hoping I'd be able to reference a variable set in the loaded movie. I've been trying to get at the variable 'count' in the loaded movie through _level1.count, as well as trying _root on the beginning and such, and that's not getting me anywhere.
Is this possible? Any ideas would be appreciated.

Copyright © 2005-08 www.BigResource.com, All rights reserved