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




Flash CD File References



Im trying to figure out how to refer my flash exe to open htm files on the same cd, but for some reason it doesn't want to open it.

This is the script I put in:
on (release) {
getURL("\websites\main.htm", "_blank");
}
(I only put one "" in, but flash puts in two)

This is the location of the file:
G:websitesmain.htm
(I don't want to specifically refer it to drive G as it may not be the drive in every computer)

And this is the error message I get:
Cannot find 'file:///G|//websites/main.htm'. Make sure the path or Internet address is correct.


Any Ideas? Please help! A good amount of my college career depends on it. Thanks!



FlashKit > Flash Help > Flash General Help
Posted on: 01-08-2004, 08:32 PM


View Complete Forum Thread with Replies

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

Random File References...
At runtime I'm pulling in two flv videos, one external swf, and xml data by way of a php proxy. All four of those files live in the same directory (as does the main flash app) called '/swf'.

My paths for loading are thus:

PHP Code:




flvPlayback.source = 'video1.flv';Loader.load(new URLRequest('/swf/mySwf.swf'));Loader.load(new URLRequest('/swf/proxy.php'));







So this is working but it's kind of crazy (and my integration guy thinks I can't copy-paste file paths). It seems like the Loader/URLRequest method is starting at the top of the domain while flvPlayback is referencing files from where the swf lives...can anyone explain whats going on here and why?

File References In AS2.0...IRRITATING.
lets say I have a folder structure like so:

ROOT
----flashFilesDir
--------flashfile.swf
--------xmlfile.xml

----index.php

and I embed the flashfile in index.php....

How can I get filashfile.swf to reference xmlfile.xml without having to use an absolute url...it simply looks in it's own directory.

By some terribly frustrating thing, it always looks in the directory of the file that is embedding the flash file....which, seems to me to be a stupid design decision. (e.g. if you embed it in /index.php, the file reference root is the same folder that index.php is in, no matter where the flash file is.)

Any ideas?
I have heard to use the _root._url (which should return the path (and file name) of the .swf file (e.g. http://sdfsdf.com/flashfile/flashfile.swf, but then you have to strip off the name of the .swf file to get the path... which == not really elegant.)
there must be a better solution?!!

thanks

References In Flash
I’m attempting to make a very simple image gallery, however one feature I wanted to incorporate was to be able to load the images in the background while the viewer is looking at the first image. To do this I’m loading the locations of the images from an XML file and dynamically creating instances of the image movie clip and the button movie clip. Initially all of the buttons are invisible, and don’t become visible until the corresponding image loads. Here is an illustrative selection of my code:

clickAction = function (whichBtn) {
trace(whichBtn); //this works
trace(whichBtn.num); //this works
}

var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();

myMCL.addListener(myListener);

myListener.onLoadComplete = function (whichImg){
trace(whichImg); //this works
trace(whichImg.num); //this does NOT WORK.
}

i=0; // total is the number of images found in XML file
while(i<total){

this.menu_e.duplicateMovieClip(”menu”+i, i); //button
this[”menu”+i].num = i;

this.bg_image.duplicateMovieClip(”bg_image”+i, total+i); //mc for image
this[”bg_image”+i].num = i;

this[”bg_image”+i]._alpha = 0;
this[”menu”+i]._visible = false;

myMCL.loadClip(image[i], “bg_image”+i); //image[i] houses address from XML file
i++;
}

My question is this: why can I refer to the .num property (of the button) in the clickAction function while I cannot refer to the .num property (of the image) in the onLoadComplete function? Both movie clips were created in the same way. Can I not access the one because it is referenced through a Listener? How can I solve this? Or is there an alternative way to solve this that would be better?

Thank you for your time.

Query Strings As Relativer References In Flash
I'm wondering how to get a query string to function as a relative reference in a get url action. I can make it happen as an aboslute reference,

ex. getURL ("http://205.197.92.66/product_listings.asp?CategoryName=bracelets");

But not as a relative ref.,
ex. getURL ("product_listings.asp?CategoryName=bracelets") ;

In the realative ref. a backslash is being added before the ? once loaded in the browser. Any ideas?

Problem With Javascript Function References From Within Flash
i am having a problem with Explorer 5 on OS 9 Mac not recognizing any getURL actions that reference javascript functions within the swfs html page. Format looks as such (on a button):

on (release) {
getURL("javascript:yourFunction()");
}

The javascript function itself is never executed, and also, in some instances, the flash reacts in an odd manner. I've never experienced any problems with this functionality until the issue was reported to me last week. As far as I know, this problem never existed with this browser until very recently, but i could be mistaken. Even the person who reported the problem indicated that it had been working fine when he hit the site only a day or two earlier. I went and checked some other sites i have done this functionality with and they were not working on this browser either. Is anyone familiar with this issue, experienced problems themselves, or have a fix/workarounds for it?

Need Some References Or Ideas To Build A Karaoke Flash Software
Hello all!

I want take a new changellence on Flash.

Now i want using flash to build out a Karaoke System that is same as karaoke shop.

Did any one can share me same ideas or references about Flash Karaoke System?

I am first time writing Flash Karaoke so need some references or ideas from you to start design this system.

Something To Do With References
Hello,

I'v got the scripts below to create a simple menu and I've narrowed down the problem to var temp, it needs to be just "holder+i", but I can't get it to work. Any help would be great!

ActionScript Code:
stop();
////////////////////////Setup Thumbs\\\\\\
menuCount = 16;
i = 0;
function loadThumb() {
    i++;
    if (i<=menuCount) {
        attachMovie("holder", "holder"+i, getNextHighestDepth());
        var myThumbs:String = "images/illustration/thumb"+i+".jpg";
        var temp = ["holder"+i];
        temp.loadMovie(myThumbs);
    } else {
        clearInterval(intervalID);
    }
}
var intervalID;
/////SetThumb
function setThumb() {
    intervalID = setInterval(loadThumb, 100);
}
setThumb();

Thanks!
Al

Some Very Useful For References
hope u all know about the flash decompiler which gets the source files of all the swf files and the software called save flash which is used to save the flash animations from all the websites.try searching all this in the google you will get it and also the updated flashplayer 8 from www.macromedia.com.hope this will help you out.

XML References
I'm setting up a system that has multiple XML files that reference each other....one is basically the master that says where the pages are for the program, the other xml files simply refer to the master, but contain the content that is displayed on screen. I am using the XMLConnect component in conjunction with the Tree component and everything works great there.

What i need to do is figure out how to cross reference the XML file pulled to display the tree and the master XML file. I'm trying 2 different methods of loading the master XML file....through the Dataholder component (which i can't seem to figure out much about) or just through setting up a standard xml importing script. The data is there, but i'm not sure how to reference that data from the tree script.

Example:
The Tree script has a variable that references a page number (page: "121") while the Master XML file has that same page number (num: "121"). When a user clicks the page in the tree...i need to access the master xml array, find (num: "121") and pull the information from that record.

Any help is appreciated...

Thanks

References
I am new to flash, I know how to make basic animations (that suck) and do most of the extremely basic things.

Anyways, does anyone have any good web sites that teach flash using turorials or even written descriptions that are free?

If you know of any please tell me them it would be of a huge help!

AS References?
Hi everyone,

Just looking for some direction w/o getting in the way.

brandnew to AS and programming thought I know Flash Animating tools fairly well and PS, Illustrator, etc. I can do animations but script is something I know nothing about.

Question-

1. Any good books on learning ActionScript ? (remember I don't know any programming)

2. Anyone read/heard about AS MX for Dummies ?

Thanks a lot....

Moving An MC By References From Other MCs
I seem to have a problem with the math on this one, I can't seem to get it right.

Heres the link:

http://www.mdssolro.com/testing/mathproblem.html

Sorry for the crappy quality image, I will be using other images, but I wanted the filesize low so I can preview the swf quickly.

The way this works, is that the larger image, masked by the outlined window is supposed to move in reference to the dragable box and the original image.

Any help would be cool,

Thanx,

Various Scripting References -HELP
hi i realy need your heeeeelp

i´d like to know how can i do with one touch on button

1 - move with "MC" (this is what i know i´ll use "Various scripting references":-))

2 - AFTER "MC" finish his move, load for external
swf (this is what i don´t know)

ONE TOUCH (i want to use actionscript, no motion tween)

thank you a lot

JAn (sorry for my english)

P.S.Various scripting references u can find on FLASHKIT Tutorials

Pointers And References?
Hi,

How do I create a pointer or reference variable? I tried using & and *, but none of them seems to work.


Code:
var a = 123;
var b = &a;
b = 456;
trace(a);


I want to set the variable b as a reference or pointer to a such that any changes made to b will be made to a. Therefore, the expected output of the above code will be 456.

Thanks in advance.

Justin

In Need Of Some References Assistance.
Greetings, all.

I'm new here, and new to flash. (I haven't touched flash since Flash3, and didn't get too far in that besides simple motion and tweening.)

Anywho, on to what I'm looking to learn how to do...

There are a few effects I'm learning how to do...mainly to spiff up my headers a bit.

For example, http://www.teamaccurate.com/

The header there, I'm looking to learn how to do the flash aspect of it. If anyone could point me in the right direction, I would appreciate it.

Thank you much,
Timb


Edit: I'm assuming it has something to do with masking, but I am not sure. So I figured I'd ask some of you more experienced people. Again, thanks.

Unwanted References
When I have this code...


Code:
var point1:Point = new Point();
var point2:Point = new Point();


I have two separate Point instances, but if I then do this...


Code:
point1 = point2;


point1 becomes a reference to point2. Is there any way to avoid this, such that a copy of point2 is made, or just so that only the values are copied, but they remain two separate instances.

XML And Object References
As a part of a CMS I want to link certain Objects to each node in some XML that I load.

Basicly here is the setup


Code:
// Step 1
var clip:MovieClip = new MovieClip();
clip.name = "My Clip";
trace("Name:" + clip.name); // out: My Clip

// Step 2
var myXml:XML = <node id='1'><node id='2' /><node id='3'/></node>;
trace("Node id:" + myXml.node[0].@id); // out: 2

// Step 3
myXml.node[0].obj = clip;
trace("Object:" + myXml.node[0].obj);

// Step 4
var obj = myXml.node[0].obj;
trace("Name:" + myXml.node[0].obj.name); // out nothing

trace("Type of:" + typeof obj); // out: xml
trace(myXml.toXMLString());
So clip is casted to a string and inserted as an attribute in myXml, -and the reference to clip is lost.

Is there any way to attach an Object reference to a XML node, in a way that makes it possible to retrieve the object back from the XML instance?

Best regards

Martin

XMLList And Xml Tag References
Here's what works:


ActionScript Code:
xml = new XML(e.target.data);
trace(xml); // outputs: <images>
                           // <image>01.jpg</image>
                           // <image>02.jpg</image>
                     // </images>

Here's where it doesn't:


ActionScript Code:
xml = new XML(e.target.data);
trace(xml); // outputs same as above
var il:XMLList = xml.images;
trace(il); // doesn't output anything

I thought it might be an error with my xml file, but it seems to load fine and it also tried this and it worked fine:


ActionScript Code:
xml = new XML(e.target.data);
trace(xml); // outputs same as above
var il:XMLList = xml.children();
trace(il); // outputs: <image>01.jpg</image>
                    // <image>02.jpg</image>

Does anyone know what I am doing wrong in that second snippet of code? Could it still be a problem with the xml file?

XML And Object References
As a part of a CMS I want to link certain Objects to each node in some XML that I load.

Basicly here is the setup


Code:
// Step 1
var clip:MovieClip = new MovieClip();
clip.name = "My Clip";
trace("Name:" + clip.name); // out: My Clip

// Step 2
var myXml:XML = <node id='1'><node id='2' /><node id='3'/></node>;
trace("Node id:" + myXml.node[0].@id); // out: 2

// Step 3
myXml.node[0].obj = clip;
trace("Object:" + myXml.node[0].obj);

// Step 4
var obj = myXml.node[0].obj;
trace("Name:" + myXml.node[0].obj.name); // out nothing

trace("Type of:" + typeof obj); // out: xml
trace(myXml.toXMLString());
So clip is casted to a string and inserted as an attribute in myXml, -and the reference to clip is lost.

Is there any way to attach an Object reference to a XML node, in a way that makes it possible to retrieve the object back from the XML instance?

Best regards

Martin

Object References?
Ok not even sure if i worded that properly, but i would like to pass a reference to an object via an arguement.

In my document class i call an external class with a few arguements:


ActionScript Code:
var myclock1:ObjectTimer = new ObjectTimer(1 , 4, 'nut1.png', 84, 41, 'ExpandAPrimary', left);


'ExpandAPrimary' is a reference to an object that is defined in the class body of the ObjectTimer class.


ActionScript Code:
var ExpandAPrimary:Object={scaleX:1,scaleY:1,time: 1,transition:"easeOutElastic", _blur_blurX:0, _blur_blurY:0};


How do a attach the ExpandAPrimary object in the ObjectTimer Class to a global variable such as selectTransition ?

right now i have this as my constructor function:


ActionScript Code:
public function ObjectTimer(_myInTime:Number, _myOutTime:Number, _imageUrl:String,_x:Number,_y:Number,_transition:String, _direction:String);

// stuff

var selectTransition:String = _transition;

but i dont think that's correct. Something to do with Object vs. String? When i trace it - it just outputs the string value. I need to assign the variable to the object that is being referenced via the string, not assign a string value.

Any hints?

Pointers And References In AS3?
I'm confused.

I want to keep performance to a max from the start of this project (it's always a pain to go back later) and I'm wondering how Flash (specifically AS3) handles the classes. For example, when I set an existing variable to a already made one, does it copy, or just point to it?

I have classes that should be accessible by many classes, but I'm not sure how this stuff works in AS.

If anyone could explain how Actionscript handles that would be great, and links appreciated as well. Thanks!

Weak References
I was wondering if someone can explain when is the best time to use a weak reference when registering an event listener. In the past I have made it my business to explicitly unregister a listener once its done it's job. I guess I'm still a little confused as to how weak references work.

As I understand it, when registering an event listener with weakReference set to true it immediately becomes eligible for garbage collection. Does this mean that a listener has the potential to be removed before it is even called?

For example, in the following pseudo code let's say that MyCustomClass.CUSTOM_EVENT doesn't fire for several
minutes. So does that mean the customEventListener may never be called if a garbage collection cycle occurs?



Code:
function myFunction():void {
var m:MyCustomClass = new MyCustomClass();
m.addEventListener(MyCustomClass.CUSTOM_EVENT, customEventListener, false, 0, true);
}

function customEventListener(e:Event):void {
trace("custom event fired");
}
Ultimately if someone can give an example of when weak reference should be used it would be appreciated.

Weak References
Hello all

Considering setting useWeakReference to true.. Is there a risk that a listener, thus configured, may be grabage collected before it has a chance to perform its action? After all, the garbage collector does its thing at its own discretion...

Thanks for any advice!





























Edited: 11/21/2007 at 07:13:55 AM by AV8|

Weak References
Hi all

Are there any disadvantages with using weak references for eventlisteners ?
That is, instead of doing this:

obj.addEventListener(Event.CHANGE,someEventHandler);

I would do this:

obj.addEventListener(Event.CHANGE,someEventHandler,false,0,true);


I know that I should ensure to unsubscribe all events, but using weakrefs would help garbage collection in case that I forget

to unsubscribe some event handler.
My question is:

Does using weak references like this impose any performance overhead or othere disadvantages ?

And by the way, when adding event listeners in mxml code of a Flex app, are weak references then used ?

Best regards S.Schmidt

Pointers And References
Hello.
Is there any way to get the address of a variable etc like in c/c++?

Like:
var someRef = &_root.as['someVar'];

or

function whatnot( var *someVar ) { ... }

My initial tests shows that flash makes copies of everything, even selfsefined objects! Surely there must be support for something else...

Help With Buttons And References
Basically I have 6 Layers

RedButton
Blue Button
Green Button
OrangeButton
Text
Actions

Each of the buttons corresponds to a different word which I have nested inside the "Text" movieclip which when pressed SHOULD bring up the word with a little alpha from 0-100
Each word has an instance name to be referred to as well.

Here's my action script for the first button

this.RedButton.on(release){
_parent.Text.Hello.gotoAndPlay(2);
}

When it compiles it gives me an error of "Field name expected after "." operator. Anyone know what this is or how I can fix my code....see any other errors? What's the best way to approach this movie?

Thank you for all your help...you guys are awesome.

Buttons And References....Please Help
Basically I have 6 Layers

RedButton
Blue Button
Green Button
OrangeButton
Text
Actions

Each of the buttons corresponds to a different word which I have nested inside the "Text" movieclip which when pressed SHOULD bring up the word with a little alpha from 0-100
Each word has an instance name to be referred to as well.

Here's my action script for the first button

this.RedButton.on(release){
_parent.Text.Hello.gotoAndPlay(2);
}

When it compiles it gives me an error of "Field name expected after "." operator. Anyone know what this is or how I can fix my code....see any other errors? What's the best way to approach this movie?

Thank you for all your help...you guys are awesome.

References In Functions?
Hi

I'm pretty new to actionscript, so This question might sound stupid but here it comes:

When you in a function pass a reference e.g: "private function test (argument:Sprite)..." does flash copy the sprite into the function which in my opinion would take a lot of time, or does it simply paste a reference? Actually we could compare it to a filesystem, does it copy the directory and name, or does it copy the whole file?

I am sure it must be the first, but I just wanted to be absolutely sure

Thanks in advance

Pointers And References
Hello.
Is there any way to get the address of a variable etc like in c/c++?

Like:
var someRef = &_root.as['someVar'];

or

function whatnot( var *someVar ) { ... }

My initial tests shows that flash makes copies of everything, even selfsefined objects! Surely there must be support for something else...

Business Help / References To Any Example Contracts
Hi there,

I am wondering if anyone can refer me to any sources where i might view some examle contracts when it comes to web-design. I am aware of things i need t oconsider but would like some advice about the correct way to establish the following with clients:

-deposit before work proceeds
-dead-lines or work completed before next payment due
-fla handovers
-finalizing

Any help or advice will be greatly appreciated. I think i remember reading somewhere at some point that there was a particular site dedicated to discussing tjis with some example contracts, called sally's site or penny's list - but as you can see my memory fails me.

Thanks in advance

Francesca

'Dynamic' Movieclip References
Hi

I am trying to find out the values of some movieclip properties. I want to be able to tell Flash to check several movieclips, so I will pass a unique value for each movieclip to the function.

Can someone please tell me why, in the following function, trace 1 returns the length of _root.movieX but trace 2 does not?

function doTraces(whichMovie)
{
trace('1) movie X length = ' + _root.movieX._totalframes + ' frames');

myMov = ('_root.movie' + whichMovie)
trace('2) movie ' + whichMovie + ' length = ' + myMov._totalframes + ' frames');
}


Many thanks

Dan

04 Data Component References
Anyone know where I can find these? The trial download seems to ship without them.
Thanks,
Gaius

Need Some References And Points Into The Right Direction...(help)
Ok, I'm not asking for anyone to hold my hand. Just let me know what books to buy, what websites to go to, what key words/techniques/things to search for so I can learn how to do this.

The Project:

Information (Part I dont need help with)
I work for a soup company, they want us to make a web based inventory locator. What I want to do is make a basic ASP or PHP page with a search box by item #, item name, and a few other things. Then they just hit search. The result page will tell them if its in dry storage, the freezer, or the cooler. Then it will tell them what section and row it is in.

Now,

The part I do need help with:
(books, references, websites, tutorials, any ideas) is. I want them to be able to click "Show me!" Then it will open up a flash based map of every storage area, it will show the rows the sections all of it.

This map will have a red square flashing over the location of the item they are searching for.

My Ideas:
(let me know if I have the right idea, and please help me figure out HOW to do it, again, books I need to buy, websites, tutorials etc. etc.)

Basically I need to cut up the map, store the x,y coords of each section of the map somewhere in flash, and label each coord. (i.e. Section_C1103 : x= 113 y= 218) or something like that.

Then, I need to make it so flash will pull the search result from the ASP or PHP page whatever it may be(see example). Once it picks up that result from the results page, it refers to the x,y coords that are labeled, then takes the x,y coords from whichever one it was, and makes that flashing red sqare (which will be a symbol) and moves it to those x,y coords over the static map. Showing the person where it is.

Example:
Person enters Raw Chicken into the search box, Hits search. Results come back like:

Raw Chicken
Location : Freezer
Section : F2109

The person then clicks "Show Me!" so flash takes F2109, refers to the stored x,y coords and looks for "Section_F2109" finds it, then checks the x,y coords of that section, and places the flashing red square symbol over those coords.


I realize this may be a little foggy and I apologize if it is. Any questions you may have please feel free to ask and I will clarify. Thank you so much for you help

Contact info:
AIM : Physikalx

Thanks again.

-Phys

External References Question
hi!
how to load movies or images which is outside of flash file but into the same directory?
any help appreciated!
thanx in advance!

'cyclic References' Between Classes
Hi. How can I do 'cyclic references' between classes. There are same references as _parent-_child in MovieClip, bat between any other classes...
Best regards.


Code:
A.as:
class A
{
var _b:B;
}

B.as:
class B
{
var _a:A;
}

compilation
A.as: Line 2: The name of this class, 'A', conflicts with the name of another class that was loaded, 'A'.
or
B.as: Line 2: The name of this class, 'B', conflicts with the name of another class that was loaded, 'B'.

[F8] SlideShow Object References?
I am making a slideshow presentation in Flash 8 with nested slides, and want to have a play/stop button to control whether the slideshow is automatically playing or not.

I have used a boolean to store whether it is playing or not. I have created two buttons, one "slideshow_p" and one "slideshow_s", to turn playing on and off. I have placed both on the parent slide of the presentation. I am having trouble getting the two buttons to swap depths.

I have tried the following actionScript on both buttons:

playSlideshow.swapDepths(stopSlideshow);
_root[slideshow_s].swapDepths(_root[slideshow_p]);
_parent.currentSlide.slideshow_s.swapDepths(_paren t.currentSlide.slideshow_p);
and
this.swapDepths( 1 );
slideshow_p.swapDepths ( 10 );

I still can't get the swapDepths to work. Can someone help me figure out how to reference objects on a slide in a presentation?

Giving References In Parameters
when giving a parameter to a function, such as a point, the function uses a copy of that point. how do you give a reference instead of a copy?

Objects With Multiple Name References
Hey all. I'm working on a script that converts XML into objects. Currently, it makes it so that XML can easily be hailed using, for example, xml[0][0][1][2][0] instead of the tedious firstChild, lastNode, nextSibling etc. syntax.

Using numbers is very useful because then you can loop through the data, but I wonder if it wouldn't also be possible to refer to it by a name as well. Sure, I can make it so that the objects solely use a name for reference (e.g. xml["xmlobject"]["recipe"]["ingredient"]["location"]) but then I wouldn't be able to loop through it anymore.

So is it possible for me to refer to an object with two different names, so that I can, for example, use


Code:
for (var a = 0; a < xml[0]._length; a++) {
trace(xml[0][a]["ingredient"]._value); // Traces "tomato"
trace(xml[0][a][0]._value); // Traces "tomato"
}
Thanks!

Concatenating Function References
I'm trying to use setInterval to run through a string of functions at 1 second intervals. To do so, I'm calling a function (runAnimations) at each interval which in turn calls a concatenated function reference, by updating the variable in the concatenated function reference each time that runAnimations is called, I should be able to call a string of functions. I think...

But naturally (or I wouldn't be here), not all is working according to plan. The line of code calling the concatenated function isn't working. I don't know if the scope is off (all code is on frame 1 of the root timeline), or what might be my problem.

Any ideas what I am doing wrong?

thanks,
tophers



// 6 :: Surface Sample
function illustration6():Void {
// not very relavant code here....

// Surface Sample Animations
// Run several animation functions sequentially at 1 second intervals
var currentFunction:Number = 1;
function runAnimations():Void {

/* This is the line that won't work
_root["surfaceSampleFunction"+currentFunction]();
*/

if (currentFunction >= 3) {
clearInterval(animationInterval);
}
currentFunction++;
}
// Specific Animation Functions
// 1 :: Fade in dot
function surfaceSampleFunction1():Void {
// code that fades in do
}
// 2 :: Rotate endcap
function surfaceSampleFunction2():Void {
// code that rotates endcap
}
// 3 :: Fade out dot
function surfaceSampleFunction3():Void {
// code that fades out dot
}

// Run the interval calling the animations var animationInterval:Number = setInterval(runAnimations, 1000);
}

Trying To Remove Sound References
I am working with some existing code that was adopted from another project I worked on. The code loads in sounds and I want to remove any reference that deals with sound loading/executing etc. Everytime I comment out in the code what I feel deals with the sound loading/playing, I screw the code up and get errors when I compile (publish) the code can someone look at my code and tell me what I should take out or post a new version of it with what needs to be stripped out - stripped out? I would SO appreciate it!

Here is my code:

ActionScript Code:
var init = function () {
    stop();
    preloadBase();
};
var done = function () {
    // done loading, hide the preloader and start the movie
    mProgress._visible = false;
    gotoAndPlay("start");
};
var preloadBase = function () {
    // start preloading the base movie (_root)
    updateProgress(0, "Loading Data...");
    loadInterval = setInterval(doPreload, 100, _root);
};
var doPreload = function (m) {
    // update the preloader while the base movie or XML is loading
    updateProgress(m.getBytesLoaded()/m.getBytesTotal()*100);
    trace(m.getBytesTotal());
    if (m.getBytesLoaded()/m.getBytesTotal() == 1) {
        if (m == _root) {
            getXML();
        }
        clearInterval(loadInterval);
    }
};
var parseXML = function () {
    clearInterval(loadInterval);
    // run through the XML to get the text and image data
    // text goes into the textVars object
    _global.textVars = new Object();
    // images go into the images array
    _global.images = new Array();
    var d = this.firstChild.firstChild;
    while (d != null) {
        // trace(d.nodeName);
        if (d.nodeName == "text") {
            _global.textVars[d.attributes.name] = d.firstChild.nodeValue;
        } else if (d.nodeName == "image") {
            var i = new Array(d.attributes.file, d.attributes.mc);
            _global.images.push(i);
        } else if (d.nodeName == "sound") {
            _global.sound = d.attributes.file;
        }
        d = d.nextSibling;
    }
    updateProgress(100, "Loading data...");
    if (_global.images.length>0) {
        loadImages();
        loaded = 0;
    } else {
        done();
    }
};
var getXML = function () {
    updateProgress(0, "Loading data...");
    callData = new XML();
    callData.ignoreWhite = true;
    callData.load("testdata.xml");
    // loadInterval = setInterval(doPreload, 100, callData);
    callData.onLoad = parseXML;
};
var updateProgress = function (pct, msg) {
    bar._xscale = pct;
    if (msg != undefined) {
        mPreloader.tMsg.text = msg;
    }
};
var music:Sound = new Sound();
var loadMusic = function () {
    updateProgress(0, "Loadng sound...");
    music.onLoad = function(success:Boolean) {
        if (success) {
            //this.start();
            trace("Sound loaded");
            done();
        } else {
            trace("Sound failed");
        }
    };
    music.loadSound("sounds/track.mp3", false);
    loadInterval = setInterval(doPreload, 100, music);
};
var loadImages = function () {
    //
    // this assumes that the clips to hold the images aren't added using createEmptyMovieClip
    // the images and the movie clips they load into are in the XML file with the text
    // make sure whatever image placeholder you will use is in the first frame of the movie
    // also, make sure you don't remove the placeholder from the movie, or the image will
    // also be removed!
    //
    updateProgress(0, "Loadng photos...");
    for (var i = 0; i<_global.images.length; i++) {
        var m = _global.images[i][1];
        my_mcl.loadClip(_global.images[i][0], m);
        m._visible = false;
    }
};
var my_mcl:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadInit = function(target_mc:MovieClip) {
    ++loaded;
    updateProgress(loaded/_global.images.length*100);
    if (loaded == _global.images.length) {
        updateProgress(100);
        loaded = 0;
        loadMusic();
    }
    target_mc._visible = false;
};
my_mcl.addListener(myListener);
//start it up!
init();

Object Management And References
Hi,

I am currently working on a game in which I have a central place for creating Entities, called EntityManager. This singleton class maintains a map (associative array) of references to all created Entities. These are created using the method
Code:
private var mEntities:Array;

public function createEntity(name:String):Entity
{
if (name && !mEntities[name])
{
var ent:Entity = new Entity(name);
mEntities[name] = ent;
return ent;
}
return null; // For clearance, would be better to throw an exception
}
It would make sense to me when I have a create operation, I als have a destroy operation, which would look like

Code:
public function destroyEntity(name:String):void
{
if (name)
{
var ent:Entity = mEntities[name];
delete mEntities[name]; // Clear the place in the map
// Make all references to the Entity invalid, but how???
}
}
How could I make all references to an object invalid? Calling a sort of destructor in which I call delete this, doesn't do the trick.

Can anybody point me the right direction?

Cheers!

Class References From Strings?
I'm trying to build a list of animation movieclips as name/value pairs, where value is a string corresponding to the name of an exported MovieClip in the library. I'd like to be able to add a clip to the current Display Object, without having to explicitly name it in AS3 code.

I'm currently doing something like this:


ActionScript Code:
var myClip = "myMovieClip";
if (myClip=="myMovieClip"){
    var mc = new myMovieClip()
    addChild(mc)
}





The problem is that a) I end up with a huge if/then list and b) my users are going to want to define their own movieclips, but are not going to want to end code to get them to work.

Is it possible to get a reference to a Class (in this case, an Exported MovieClip instance) from a string?

I'd prefer something like this:



ActionScript Code:
//Assuming a movieclip in the library, exported as "myMovieClip"
var clipRef= "myMovieClip";
var classRef = Class(clipRef);
var newClip =  new clipRef();
addChild(newClip);




Any suggestions?

Decent AS3 Offline References?
Hello there,

I'm going on holiday soon and it's highly likely I'm gonna have some time to kill on my trip with my laptop, so I'm wondering if anybody has any ideas on obtaining a good offline reference. I'm thinking more specifically about getting an offline version of Adobe LiveDocs by caching it maybe? I'm not sure exactly how to do this, nor if it's against the rules. Also, I'm open to other methods, but being that I'm travelling, I don't wish to carry anything paper-based

Thanks

Dynamic References In For Loops.
Greetings ~ I'm wondering what method people use to load things into multiple movie clips, that have the same name barring the trailing numeral. As in - how to address the clip on the left side of the = sign with [i] type syntax. For example:

function loadImage0(url:String):void {
imageLoader[i] = new Loader();
imageLoader[i].load(new URLRequest(url));
imageLoader[i].contentLoaderInfo.addEventListener(Event.COMPLETE , imageLoaded[i]);
}

If I run something like this I get errors like imageLoader[i] doesn't exist. I've seen this before trying to pump up clips with a loop and getting thrown off by what to do on the left side of the = sign. Thanks.

Any help would be appreciated, thanks!

Comparing MovieClip References
Is there anyway to compare the actual references to a MovieClip as opposed to just their target paths?

For example, if I store a reference to a movieclip (e.g. oldmc), delete that movie and the create a new one (e.g. newmc) with the same targetpath then (oldmc==newmc) will be true, even though the oldmc has been unloaded.

'new' And Obj.attachMovie() Not Returning References WHY?
Has anyone run into a 'new' operator or obj.attachMovie() not returning a reference, even though the object is successfully created? I can see the MC on the screen, or the effects of the object, and yet the vars into which I stored the references are tracing as 'null' (which is the value to which I initialized them)
Any help would really be appreciated since the whole project is in a full-stop right now because of this, and I can’t figure it out why it’s happening. The worst thing is that the code was working until it just stopped functioning, don’t know why, at the time I was working on a completely separate module from the one that’s causing problems.

I would really appreciate it if someone even suggested something.
Thank you

A Question About Buttons And References...
ok so before i do some thing stupid like follow my laptop out of the window i have a question and hopefully one of you nice people will save me and more importantly my new laptop...

is it possible to reference things through a button, i have these 2 bits of code...

colourBlue01 = new Color(_root.main.outlines.topUndercolour);
colourBlue01.setRGB(0x336699);
colourBlue02 = new Color(_root.main.infoBox02.infoBox02A.infoBox02.to pBar.topColour);
colourBlue02.setRGB(0x336699);

nothing new there the code changes the colour of movieclip topUnderColour and topColour. easy however the first colour change works (colourBlue01) and the second does not (colourBlue02) now the second one including the movie topColour are referenced through a button which is infoBox02A, i know my naming conventions are crap. should the fact i am trying to reference though a button be an issue? another thing is the reason i am referencing through a button is that the movie clip topColour is dragable! any ideas would be great

cheers sam

Scene References Showing In URL
Hi all,

I have a 5 scene movie that runs on my home page. The ref' number for each scene appears at the end of the page URL in the address bar, as if each different scene were a separate page (separate URL):

For example, http://www.mydomain.com/home.html#s1 (. . then #s1Out, then #s2, then #s2Out, etc., as the movie plays through its five scenes).

Google bot is seeing this as duplicate content, even though I have only one true home page.

Any idea what's causing this? How to fix?

Thanks for your help!






























Edited: 10/11/2008 at 02:26:56 PM by dogboysoccer

Null Object References
O.K. I've got my classes talking to one another - yay - but now I'm trying to draw onto an image loaded into a scrollpane and it's telling me it's not really there. I've used trace(this.parent); on holder_sp and it's coming up as null even though I can see it and it's loader image on the stage. My graphic is fine and lives on the stage. I'm clear on the transform matrix to get it into a bitmap, but I want to add the image to the bitmap and the add the line object to it. I'm so close to finished I promise once this is over you won't see me for a while. Sorry to be a pest.







Attach Code

//This sits in the Loading.as
public function completed(event:Event):void {
_fla.lights_mc.visible=false;
_fla.lights_mc.stop();
_fla.pre_mc.fill_mc.stop();
_fla.pre_mc.visible=false;
_fla.addChild(loader);
loader.x=544;
loader.y=15;
loader.width = 263;
loader.height = 242;
var sprite2:Sprite;
sprite2=new Sprite();
_fla.addChildAt(sprite2, _fla.getChildIndex(_fla.sb_microns));
sprite2.graphics.beginFill(0x666666,0);
sprite2.graphics.drawRect(580,400,holder_sp.width,holder_sp.height);
sprite2.addChild(holder_sp);
holder_sp.x=37;
holder_sp.y=285;
holder_sp.width =772;
holder_sp.height =400;
trace(this.parent);
//results in "null"

//This is in the main.as

public function mouseUpHandler(evt:MouseEvent):void {
if (mouseX >37 && mouseX<792 && mouseY>285&& mouseY<670) {
sprite1.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
sprite1.removeChild(sprite1.getChildByName("dotStart"));
sprite1.removeChild(sprite1.getChildByName("dotEnd"));
sprite1.graphics.clear();
sprite1.graphics.lineStyle(strokeWidth_ns.value, strokeColor_cb.selectedItem.data, 1);
sprite1.graphics.moveTo(startX, startY);
sprite1.graphics.lineTo(mouseX, startY);
trace(this.parent)
var image:Bitmap = Bitmap(holder_sp.content);
var imageData:BitmapData=new BitmapData(image.width,image.height,false,0xcccccc);
imageData.draw(image,image.transform.matrix);
trace("The image is in the imageData, but it's invisible." );
imageData.draw(sprite1);
}
}
//This throws the error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main/mouseUpHandler()
}

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