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




Getting Error From Book Code



hey everybody, trying to figure out how to load an external movie into another movie and the code given to me in the book "Actionscript 3.0 Cookbook" is pasted below. However when i run it, it gives me this error messageDescription Source"1037: Packages cannot be nested." package{not sure what i could be doing wrong, i copy'ed it exactly as it is in the book to get a feel for the code before i started messing with it to actually figure out the inner workings and customize it. Thank you for your time :)package{import flash.display.*;import flash.net.URLRequest;import flash.events.Event;public class LoaderExample extends Sprite {private var _loader:Loader;public function LoaderExample() {_loader = new Loader();addChild( _loader );_loader.contentLoaderInfo.addEventListener( Event.INIT, handleInit );_loader.load( new URLRequest( "flashLoadTestMovie.swf" ));}private function handleInit( event:Event ):void{var movie:* = _loader.content;trace( movie.getColor() );movie.setColor( 0xFF0000 );}}}



Adobe > ActionScript 1 and 2
Posted on: 06/23/2007 01:37:45 AM


View Complete Forum Thread with Replies

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

SitePoint Book Error?
Can anyone tell me what is wrong with my code.
I have reviewed it many times but it doesn't seem to work like the book shows it to work...This is the VERTICAL NAVIGATION from COOL EFFECTS AND PRACTICAL ACTION SCRIPTING....
The clips that I created act weird, could it be that I am using Flash 8?
It's driving me nuts...Thanks for your help =)

_global.speed = 1.3;
_global.stickiness =8;
_global.baseX = 5;
_global.finalX = 30;
function moveOut()
{
this.xStep = 0;
this.onEnterFrame = function ()
{
if (this._x < finalX)
{
difference = finalX - this._x;
this.xStep = (this.xStep + difference * speed)/stickiness;
this._x += this.xStep;
}
if (this._x>finalX)
{
this._x = finalX;
}
}
}
function moveIn()
{
this.xStep = 0;
this.onEnterFrame = function()
{
if (this._x > baseX)
{
difference = finalX - this._x;
this.xStep = (this.xStep + difference * speed)/stickiness;
this._x -= this.xStep;
}
if(this._x < baseX)
{
this._x = baseX;
}
}
}
nav1.onRollOver = moveOut;
nav1.onRollOut = moveIn;
nav2.onRollOver = moveOut;
nav2.onRollOut = moveIn;

Error #2044: Unhandled StatusEvent:. Level=error, Code=
Receiving message: Error #2044: Unhandled StatusEvent:. level=error, code=

I have just added these three lines to a previously working fla:

import flash.net.LocalConnection;

var sender:LocalConnection = new LocalConnection();
sender.send("_exampleChannel", "example", "a string", 6.5, true);

My intent is to test passing data back to another fla. Right now the data I'm sending is nonsense. I'm just trying to test the connection and get it working. Any help is appreciated.

Here is the entire block of code:

import fl.controls.RadioButton;
import flash.net.LocalConnection;

var seqNum:Number = new Number();
var question:String = new String();
var actual_answer;
var submit_answer;

var end_result:uint = new uint();

function setVariable(quext:String) {
trace("Quext = "+quext);
Question_display.text = quext;
}

//*************** from the parent program ***************************
seqNum = 1;
//question = "New York is the capitol of the USA."
actual_answer = "FALSE";
//*******************************************************************

Question_display.backgroundColor = 0x0000FF;


//********* EventListeners for the buttons **************************
Answer_a.addEventListener(MouseEvent.CLICK, clickHandler);
addChild(Answer_a);
Answer_b.addEventListener(MouseEvent.CLICK, clickHandler);
addChild(Answer_b);
//*******************************************************************
//********* Radio button Handler Function ***************************
function clickHandler(event:MouseEvent):void {
submit_answer = event.currentTarget.label;
}
//*******************************************************************
function sub_answer(event:MouseEvent):void
{
trace("The submitted answer is "+submit_answer+", and the actual answer is "+actual_answer+".");
if (actual_answer == submit_answer) {
end_result = 1;
}
else {
end_result = 0;
}
//*************** send to the parent program ********************
trace("Your conclusions are "+end_result+".");
//*************** send to the parent program ********************
var sender:LocalConnection = new LocalConnection();
sender.send("_exampleChannel", "example", "a string", 6.5, true);

}

Submit_btn.addEventListener(MouseEvent.CLICK, sub_answer);

Mac Book Flash Web Page Error Message
Error Message:

'Could not open one or more scenes probably because of low memory'

Any ideas? This is a soul cushing impasse in a time sensitive college project. Can anyone help?





























Edited: 11/13/2006 at 05:40:43 PM by Shrinkrap

Easy Code From A Book. But Does Not Work
Hey guys, I got this code straight out of a Flash Actionscript book but I can't get it to work. The output panel does not show an error, but the code does not do what it should. It is a mouse trail

Any thoughts, would be appreciated


Quote:




onClipEvent(load){
//CREATE 10 CURSOR FOLLOWERS
for(var i=0;i<10;i++){
_root.attachMovie("glitter","glitter"+i,i);
}
//START THE ARRAY
trail = new Array();
}
onClipEvent(enterFrame){
//MARK THE MOUSE LOCATION
cursorLoc = {x:_root._xmouse, y:_root._ymouse};
//ADD THE NEW LOCATION TO THE ARRAY
trail.push(cursorLoc);
//DELETE THE OLDEST LOCATION
if(trail.length > 10) trail.shift();
//CHANGE THE POSITIONS OF ALL CURSOR FOLLOWERS
for(var i=0; i<trail.length; i++) {
_root["cursor"+i]._x = trail[i].x;
_root["cursor"+i]._y = trail[i].y;
_root["cursor"+i]._alpha = i*10; //CHANGE BLEND TO
}
}

Where Is The Code Archive For The Flash Anthology Book?
I just recently downloaded this book but cannot find the code archive anywhere on this site. Does anyone know where it is? Thanks.

Where Is The Error In My Code...?
--------------------
on (press) {
set ("/ressedcount", 0);
if (Eval("/ressed" & Substring(dama,5,1)ne "true")) {
set ("/ressed" & Substring(dama,5,1), "true");
set ("/ressedcount", /ressedcount+1);
}
if ((/ressedcount = 2)) {
setProperty (_root.ok, _visible, true);
}
}
---------------------

dama -> the name of button (I have 4 buttons but different numbers on the end)
ok -> name of a movie clip

The problem is that ok is shown even if i only click dama button once.


Thanks for your help!

? Code Error?
What's wrong?

My first on release doesn't work?

on (release) {
_root.solu.play();
}
on (release) {
_root.home2.gotoAndStop(2);
}
on (release) {
_root.comp.gotoAndStop(1);
_root.solu.gotoAndStop(1);
_root.cases.gotoAndStop(1);
_root.contact.gotoAndStop(1);
_root.tech.gotoAndStop(1);
}
on (release) {
_root.comp2.gotoAndStop(1);
_root.solu2.gotoAndStop(1);
_root.cases2.gotoAndStop(1);
_root.contact2.gotoAndStop(1);
_root.tech2.gotoAndStop(1);
}


thanks

What Is The Error In This Code?
onClipEvent (load) {
MovieClip.prototype.PlayReverse = function(bContinue) {
this.onEnterFrame = function() {
this.gotoAndStop(this._currentframe-1);
};
};
}
onClipEvent (load) {
_root.button.onPress = function() {
_root.MC.playReverse(false);
if (_root.MC._currentframe == 1) {
_root.gotoAndStop(11);
}
};
}

Any Error In This Code?
_root.now = 0;
s_sound = new Sound();
s_sound.loadSound(mu_array[_root.now].path);
s_sound.start(0,1);

s_sound.onSoundComplete = playnext();

function playnext(){
if (_root.now== _root.totalmusic -1){
_root.now =0;
s_sound.loadSound(mu_array[_root.now].path);
}else{
_root.now = _root.now +1;
s_sound.loadSound(mu_array[_root.now].path);
}
}

Error Code
hey

"the installed version of quicktime does not have a handler for this type of macromedia flash movie.please consult documentation for further information"

this happened when i tried to export my movie in quicktime format.
it doesnt complete it(no icon where i selected to export to)

?????

Error Code
Does anybody know what this Flash MX error code means?

Target not found: Target="bgmusic01" Base="_level0"

Thank you in advance.

Code Error, But Why?
ok I am really at a loss for words on this one someone tell me why this error comes up for my code.


Code:
onClipEvent (load) {
_root.var1 = 0;
_root.var2 = 0;
}
onClipEvent (enterFrame) {
if (_root.var2 == 1) {
_root.fnum = (_root.3dcontent.3d1.3d1Scrollbox._x - 175)/20;
_root.fnum = Math.floor(_root.fnum);
this.gotoAndStop(_root.fnum);
}
if (_root.var1 == 0 and _root.var2 == 0) {
this.stop();
_root.3dcontent.3d1.3d1Scrollbox._x = (this._currentframe*20)+175;
} else {
if (_root.var1 == 1) {
this.play();
_root.3dcontent.3d1.3d1Scrollbox._x = (this._currentframe*20)+175;
}
}
}
here is the Error


Code:
**Error** Symbol=3d1, layer=Layer 3, frame=1:Line 7: ')' expected
_root.fnum = (_root.3dcontent.3d1.3d1Scrollbox._x - 175)/20;

**Error** Symbol=3d1, layer=Layer 3, frame=1:Line 13: Syntax error.
_root.3dcontent.3d1.3d1Scrollbox._x = (this._currentframe*20)+175;

**Error** Symbol=3d1, layer=Layer 3, frame=1:Line 17: Syntax error.
_root.3dcontent.3d1.3d1Scrollbox._x = (this._currentframe*20)+175;

**Error** Symbol=3d1, layer=Layer 3, frame=1:Line 11: Statement must appear within on/onClipEvent handler
if (_root.var1 == 0 and _root.var2 == 0) {

**Error** Symbol=3d1, layer=Layer 3, frame=1:Line 20: Unexpected '}' encountered
}

Total ActionScript Errors: 5 Reported Errors: 5

Where Is My Error In This Code....
I'm trying to make this CSS work over multiple loaded txt files in CS3. Does anyone know why its only making the last text box (devonhouse4) load and none of the others? I have a feeling i've missed something blatently obvious!


Code:
function textLoader() {
myData = new LoadVars();
myData.onLoad = function() {
devonhouse1text.html = true;
devonhouse1text.htmlText = this.devonhouse1;
};
myData.load("devonhouse1.txt");
}
function textLoader() {
myData = new LoadVars();
myData.onLoad = function() {
devonhouse2text.html = true;
devonhouse2text.htmlText = this.devonhouse2;
};
myData.load("devonhouse2.txt");
}
function textLoader() {
myData = new LoadVars();
myData.onLoad = function() {
devonhouse3text.html = true;
devonhouse3text.htmlText = this.devonhouse3;
};
myData.load("devonhouse3.txt");
}
function textLoader() {
myData = new LoadVars();
myData.onLoad = function() {
devonhouse4text.html = true;
devonhouse4text.htmlText = this.devonhouse4;
};
myData.load("devonhouse4.txt");
}
var myCSS = new TextField.StyleSheet();
myCSS.load("myStyle.css");
myCSS.onLoad = function() {
devonhouse1text.styleSheet = myCSS;
devonhouse2text.styleSheet = myCSS;
devonhouse3text.styleSheet = myCSS;
devonhouse4text.styleSheet = myCSS;
textLoader();
};
Thanks in advance.


Christopher Mitchell

Error In Code
I have run into this problem a couple of times in different parts of my code.
I keep getting this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main_final_fla::MainTimeline/onEnter().

I am now trying to access a movie from my main timeline so that when the movie reaches frame 54, the main timeline goes to frame label begin.
Here is the code that I am using on the main timeline:

stop();


introAnim.addEventListener(Event.ENTER_FRAME, onEnter);

function onEnter(event:Event):void
{
if (introAnim.currentFrame >= 54)
{
gotoAndPlay("begin");
}
}

Thanks for any help with this.

Rob

Code Error
When I put the Stop code it stops at the first of the 20 images. When I enter the next button it starts cycling through the images rather than allowing the button to be pushed.

Verson 3.0







Attach Code

stop();

next_btn.onRelease = function() {
if (this._currentframe == 20) {
gotoAndStop(1);
}
}

Error With Code - Why?
Hi all

I have a simple function below which is passed a number as an argument. I use this argument as part of a line of code which tells 1one of four movieclips (instance names of 1, 2, 3 and 4) to move to a specific frame label, however it hasn't been working and I only found errors were being generated when I changed the line of code (you can see where I commented out my old line of code):

function MoveToFrame(frm) {
_global.kbc = frm;
//_level0.picHolder_mc.frm.gotoAndStop("used");
_level0.picHolder_mc.2.gotoAndStop("used"); // here i hard coded to see if it made a difference
}

The error I am getting is as follows:

**Error** Symbol=textContent, layer=Layer 2, frame=1:Line 6: Syntax error.
_level0.picHolder_mc.2.gotoAndStop("used");

Why is there an error occuring and how do I rectify it?

Thanks in advance.

Error With Code
hi all

i have proplem with this code

// These lines begin broadcasting.
var my_nc:NetConnection = new NetConnection(); // Create connection object.
my_nc.connect("rtmp://MYserver:1935/test"); // Connect to server.
publish_ns:NetStream = new NetStream(my_nc); // Open stream within connection.
publish_ns.attachAudio(Microphone.get()); //Capture audio.
//publish_ns.attachVideo(Camera.get()); Capture video.
publish_ns.publish("todays_news"); // Begin broadcasting.
/* These lines open a stream to play the video portion of the broadcast inside a Video object named my_video. The audio is played through the standard output device--you don’t need to issue a separate command to hear the audio. */
var play_ns:NetStream = new NetStream(my_nc);
//my_video.attachVideo(play_ns); // Specify where to display video.
play_ns.play("todays_news"); // play() uses the same name as publish() above.


the error appear is:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 5: Syntax error.
publish_ns:NetStream = new NetStream(my_nc); // Open stream within connection.

Total ActionScript Errors: 1 Reported Errors: 1

Error Code For My AS3
I have a button that I tween the alpha 0 - 100 over a series of frames and
on the last frame I place a stop action on another layer. I name the button
btnproducts and I want it
to link to another frame, so I use this AS3 code:


btnproducts.addEventListener(MouseEvent.CLICK, buttonClick2);
function buttonClick2(event:MouseEvent):void{
gotoAndStop(54);
};



When testing it, I get this error:

The class or interface 'MouseEvent' could not be loaded.

What is wrong?

Thanks!

[CS3, AS2] Error In Code - Something's Not Right
I've trying to make a site that relies complete on external files - although I'm having trouble getting my HTML to show.

The text is imported, but the text is completely transparent - I'm not too sure what the problem is.

I'd really appreciate it if someone could have a look.

Thanks.

http://h1.ripway.com/Unconscious/site.zip

Php Code Error
Ok so I have one input text box and a send button next to it. when u type your email addy in the box and hit send i want it to email your addy to my address. Ok everything is lookin coded correctly except my php, here it is: i know this is completely wrong but its my sad attempt

<?php

$sendTo = "webmaster@zeroxposur.com";
$subject = "Add me to the Freakin Mailing List";
$headers = $_POST["email"] .">
";
mail($sendTo);

?>

What Is The Error In This Code?
onClipEvent (load) {
MovieClip.prototype.PlayReverse = function(bContinue) {
this.onEnterFrame = function() {
this.gotoAndStop(this._currentframe-1);
};
};
}
onClipEvent (load) {
_root.button.onPress = function() {
_root.MC.playReverse(false);
if (_root.MC._currentframe == 1) {
_root.gotoAndStop(11);
}
};
}

"sorry for my english"

i want that after the release or press the button my movieclip reverse and than go to the frame 11 in main timeline.

Can U Find The Error In This Code?
I have this code that causes the movie clip to jump to a specific frame, depending on which radio button the user selects.
The problem is, for the first radio button (rfss) it only works once, and only if it is the first choice for the user. If the user selects one of the other radio buttons first, then they cannot select the first RB (it just won't jump to the frame, although the RB is visually selected).

Also, if the user does select the first RB first, the RB is not visually filled in (selected), even though it jumps to the right frame.

//CODE

stop();
function onChange(component){

if (forms.getValue()=="rfss"){
gotoAndStop(2);

}else if (forms.getValue()=="newid"){
gotoAndStop(3);

}else if (forms.getValue()=="terminate"){
gotoAndStop(4);

}else if (forms.getValue()=="authprod"){
gotoAndStop(5);

}else if (forms.getValue()=="helpdesk"){
gotoAndStop(6);

}
}


Can anyone help me out?

THANKS!

Help, Help, Need To Solve The Error In My Code.
I attached the fla.



Here is the query:

on a MC (call it MC_a) placed on a mask layer (inside another MC, call it MC_main) I have the following code:

Movieclip.prototype.floatTo = function (speed, endx, endy) { var dist_x, dist_y, vel_x, vel_y;speed = "."+speed;dist_x = Math.round(endx-_x);dist_y = Math.round(endy-_y);vel_x = dist_x*speed;vel_y = dist_y*speed;_x += vel_x;_y += vel_y;};

I placed MC_main on the root timeline (a parent to the child MC_a which has the above code). On MC_main I have the following:

on (release) {

floatTo_a(3, 235, 0);

}




The problem is that MC_a on the mask layer moves partially, and does not "float" to its end x. each time I release, MC_a moves in increments to the end x.


I've used this prototype before and it has woked well.

Can anyone help me make my MC float to its end x?

Thank you

Help With Code Error Needed:
preloader for video
I know there has to be a get byte preloader somewhere but I can't seem to find a sample--does anyone know of tutorial to help with this.
Is this the correct way to preload video--I'm kinda confused with this one
THANKS



this is the code I tried :

onClipEvent(data){
//preload code
trace("data received");
_root.transferIndicator.gotoAndStop("on");
//if loaded let the movie play
if(getBytesTotal() > 0&&getBytesLoadedd() ==getBytesTotal()){
_root.transferIndicator.gotoAndStop("off");
play();
}
//display feedback

_root.bytesLoaded = getBytesLoaded();
_root.bytesTotal = getBytesTotal();
_root.clipURL = _url.substring(_url.lastIndexOf("/") +1, _url.length);

};

The problem is that MX doesn't like the

onClipEvent(data){

It gives me the error that onClip Events are for movie clips and I don't know how to correct it please help

Code Menu Error HELP
Hello every1...i have this code that makes an animated menu in flash.. but i need to load a movie when some1 press a submenu.. here is the code:

/:NumberOfMenus = "2";
// ***** MENU 1 *****
/:MenuTitle1 = "Actividades";
/:MenuURL1 = "";
/:NumberOfSubMenus1 = "3";
/:SubMenu1Title1 = "Representaciones Culturales";
/:SubMenu1Title2 = "Danza Cuba";
/:SubMenu1Title3 = "Danza Doris Topete";
// **********************
// ***** MENU 2 *****
/:MenuTitle2 = "Menu Principal";
/:MenuURL2 = "";
/:NumberOfSubMenus2 = "0";
/:SubMenu2Title1 = "menu principal";
/:SubMenu2URL1 = "http://www.zaxisnet.com";
// **********************

Look in the part that sais /:SubMenu1Title1 = "Representaciones Culturales"; that is a submenu... HOW THE HELL do i LOAD A MOVE (Not a url with a movie, just a swf) when some1 press it this submenu

Any help regarding this issue will be VERY WELL appreciated!

Peace

Preloader Code Error?
Hi
am having problems with preloader code:
loadedbytes = getBytesLoaded();
totalbytes = getBytesTotal();
loadedkbytes = Math.ceil(loadedbytes/1000);
totalkbytes = Math.ceil(totalbytes/1000);
if (loadedbytes == totalbytes) {
nextScene ();
}
frame = int(loadedbytes/(totalbytes/100));
tellTarget (_root.loader) {
gotoAndPlay ("Scene 1", 1);
}
it doesn't show all the numbers in most fields, but worse it doesn't show the percentage at all!
what am I doing wrong?
please help
joey

Typing Code Error
I've been reading tutorials and I see that I need to type in some code. My problem is that when I try to start the code, the program isn't giving me any place to type in the code.

I'm simply trying to make a sprite move around the screen. Basic up, down, left, and right movements. I see what the code is to do so...just don't know why I can't type in anything. Am I doing something wrong or is flash acting funny on me? Thanks!!!

Simple Code But Error Why?
I have a simple code:
myMusic = new Sound(myMusicMc);
myMusic.loadSound("distortion.mp3");

There is a button, on the button there is this event:
on (press) {
myMusic.play();
}

I have created a movieclip myMusicMc
but when i test it I get the following error:

Error opening URL "file:///C|/DOCUME%7E1/SADEKA%7E1/LOCALS%7E1/Temp/distortion.mp3"

why

[CS3] Error Code 1151
Hello.

Will anyone please tell me what this error is trying to tell me.

1151: A conflict exists with definition mvr_mc in namespace internal.

I have 2 layers. One with the movieclip mvr_mc and one for actions.

The action code is as follows:

var centerScreen:Number = Stage.width / 1;
var mouseListener:Object = new Object();
var mvr_mc:MovieClip;

mvr_mc.onPress = function() {
mouseListener.onMouseMove = function() {
if(this._currentframe > 0 && this._currentframe < this._totalframes) {
if(_xmouse < centerScreen) {
this._currentframe--;
}else if(_xmouse > centerScreen){
this._currentframe++;
}
}
}

}

mvr_mc.onRelease = mvr_mc.onReleaseOutside = function() {
delete mouseListener.onMouseMove;
}

Mouse.addListener(mouseListener);


Thanks

a-

[F8] Need Quick Fix For Code Error
Hi. I have a movieclip button which when pressed directs the playhead to another frame. This is the code I use:


PHP Code:



_root.submit.onRelease = function() {
    if (answer == "silence") {
            gotoAndPlay("correct");
            result += 1;
            questionNum++;
    } else {
        gotoAndPlay("incorrect");
        questionNum++;
    }
}




However, I also need to add a keypress action.
This is the code I used:


PHP Code:



_root.submit.on(release, keyPress "<Enter>") = function() {
    if (answer == "silence") {
            gotoAndPlay("correct");
            result += 1;
            questionNum++;
    } else {
        gotoAndPlay("incorrect");
        questionNum++;
    }
}




IT DOESN'T WORK!
Returns a 'expected field name after (.).

How would I write this simple bit of code?

Cheers folks!

[CS3] Flash Code Error
Hello I am trying to create a flash form and i keep receiving this error

TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at forms_start_file_fla::MainTimeline/frame1()

not sure what it means if you can help that would be great, thanks

[CS3] AS2 - Code Gives Error In Flashplayer 9, But Not In 7
Hi there,

I just imported a fire animation to my flash movie from another flash movie(copy-paste). It gives the following error:


Quote:




')' or ',' expected - duplicateMovieClip("mcFlame", "Flame" add index, index);




When I set my movie to play in flashplayer 7 it has no error(only other things..), but in flash 9 it gives this. Can I re-write the code or something?

This is the code:


Quote:




duplicateMovieClip("mcFlame", "Flame" add index, index);

xcoord=Math.random()*10;
xStretch=Math.random()*50;
yStretch=Math.random()*100;
opacity=Math.random()*60;

setProperty("Flame" add index, _x, xcoord);
setProperty("Flame" add index, _xscale, xStretch);
setProperty("Flame" add index, _yscale, yStretch);
setProperty("Flame" add index, _alpha, opacity);

++index;

Error And Code Check
my nefew asked me if I could look at his code, I have not done much with as3
I use as2. and I just got back into it. can you help me help him with his error and code please? thanks a million in advance.
he is getting error code: on frame 1 line 74
(1116: A user-defined namespace attribute can only be used at the top level of a class definition.)
here is his code.

Code:
import gs.TweenMax;
import fl.motion.easing.*;
TweenMax.from(content, 5, {y:"-100", ease:Elastic.easeOut});

var menue:String = new String();
var a:String = "myText.txt";
var b:String = "myText2.txt";
var c:String = "myText3.txt";
var d:String = "myText4.txt";
var e:String = "myText5.txt";
var defaultText = a;

stage.scaleMode = StageScaleMode.NO_SCALE;

function loadText():void {
var txtLoader:URLLoader = new URLLoader();
txtLoader.addEventListener(Event.COMPLETE, onLoaded);
content.autoSize = TextFieldAutoSize.LEFT;
txtLoader.load(new URLRequest(defaultText));
removeEventListener(Event.COMPLETE, onLoaded);

function onLoaded(e:Event):void {
content.text = txtLoader.data;
if (content.height < sb.track.height) {
sb.alpha = 0;
} else if (content.height > sb.track.height) {
sb.alpha = 1;
sb.thumb.y = yMin;
content.y = masker.y;
}
}
}

loadText();

var yOffset:Number;
var yMin:Number = 0;
var yMax:Number = sb.track.height - sb.thumb.height;

sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbUp);

function thumbDown(e:MouseEvent):void {
stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
yOffset = mouseY - sb.thumb.y;
}

function thumbUp(e:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
}

function thumbMove(e:MouseEvent):void {
sb.thumb.y = mouseY - yOffset;
if (sb.thumb.y <= yMin) {
sb.thumb.y = yMin;
}
if (sb.thumb.y >= yMax) {
sb.thumb.y = yMax;
}
var sp:Number = sb.thumb.y / yMax;
TweenMax.to(content, 1, {y:(-sp*(content.height - masker.height)), ease:Back.easeOut});
e.updateAfterEvent();
}
//buttons
btn1.addEventListener(MouseEvent.CLICK, btn_click);
btn2.addEventListener(MouseEvent.CLICK, btn_click);
btn3.addEventListener(MouseEvent.CLICK, btn_click);
btn4.addEventListener(MouseEvent.CLICK, btn_click);
buttoninstancename.buttonMode = true;
buttoninstancename.mouseChildren = false;

function btn_click(event:MouseEvent)
{
define the selected_text variable
var selected_text:String = "menue";

//Check which button is clicked on instance names
if(event.target.name == btn1) {
selected_text = "a";
} else if(event.target.name == btn2) {
selected_text = "b";
} else if(event.target.name == btn3) {
selected_text = "c";
} else if(event.target.name == btn4) {
selected_text = "d";
} else if(event.target.name == btn5) {
selected_text = "e";
}
//add se´lected text to your textfield
myTextLoader.text = selected_text;
}

Please, Find Error In Code.
Hi All,

could any one help me to load the swf through MovieClipLoader.

Code:
var holder_mc = this.createEmptyMovieClip("holder_mc", this.getNextHighestDepth())
var cliploader:MovieClipLoader = new MovieClipLoader()
var cliploaderlis:Object = new Object()
cliploaderlis.onLoadStart = function(clip:MovieClip) {
trace ("loadstart")
clip._width = 300
var init:Object = {_x:60, _y:60}//{_x:Stage.width/2, _y:Stage.height/2}
_root.attachMovie("loader", "loaderclip", _root.getNextHighestDepth()+1, init)
}
cliploaderlis.onLoadProgress = function(clip:MovieClip, bytesloaded:Number, bytestotal:Number) {
trace (bytesloaded + ", " + bytestotal)
}
cliploaderlis.onLoadInit = function(clip:MovieClip) {
trace ("loadinit - " + clip)
}
cliploaderlis.onLoadComplete = function(clip:MovieClip) {
trace ("loadcomplete")
}

cliploader.addListener(cliploaderlis)
cliploader.loadClip("EarlyMiser_330x340.swf", holder_mc)

Code Error Only In Flash 8
Hello,

When I publish the code below in Flash 8 I get the following error message.


Quote:




**Error** Symbol=part3_mc, layer=Action, frame=1:Line 4: ')' or ',' expected
duplicateMovieClip(tremble, "tremble" add c, c);

Total ActionScript Errors: 1 Reported Errors: 1





Code:
a = 5;
b = 9;
c = 14;
duplicateMovieClip(tremble, "tremble" add c, c);
tremble._x = random(a);
tremble._y = random(b);
tremble._alpha = random(45);
tremble._rotation = random(a);
When published in Flash 7 it works just fine.

I can't seem to figure out exactly what syntax it wants and where. If anyone could lead me in the right direction to make it work in Flash 8 I'd really appreciate it.

Thanks, Jason.

Error Code : 5007
Hi

This is really annoying me now....im getting this error code when i try and publish my .fla. I cant find any documentation to tell what this means!

5007: An ActionScript file must have at least one externally visible definition.

Error In Code? Or In Flash?
im making a 2D game with some of my friends but we can't find out whats wrong with our code!

[code]Mouse.addListener(watchMouse);

sKeySound=new Sound();
sKeySound.attachSound("sSound");
watchKeyboard = new Object();
watchKeyBoard.onKeyDown = function() {
trace(Key.getAscii());
if (Key.getAscii() == 32) {
player1._xscale=player1._yscale-=5;

}
};
watchKeyBoard.onKeyUp=function(){
player1.gotoAndStop(2);
arrowMC.removeMovieClip();
}
Key.addListener(watchKeyBoard);

StageWidth = 700;
StageHeight = 500;
function moveStuff() {
arrowDepth=50;
arrowX=550;
arrowY=350;
if (Key.isDown(Key.LEFT)) {
player1.gotoAndPlay(17);
this._x -= this.speed;
_root.attachMovie("arrow_mc","arrowMC",arrowDepth) ;
arrowMC._x=arrowX;
arrowMC._y=arrowY;
arrowMC._rotation=-90;
}
if (Key.isDown(Key.RIGHT)) {
player1.play();
this._x += this.speed;
_root.attachMovie("arrow_mc","arrowMC",arrowDepth) ;
arrowMC._x=arrowX;
arrowMC._y=arrowY;
arrowMC._rotation=90;
}
if (Key.isDown(Key.UP)) {
this._y -= this.speed;
_root.attachMovie("arrow_mc","arrowMC",arrowDepth) ;
arrowMC._x=arrowX;
arrowMC._y=arrowY;
arrowMC._rotation=0;
}
if (Key.isDown(Key.DOWN)) {
this._y += this.speed;
_root.attachMovie("arrow_mc","arrowMC",arrowDepth) ;
arrowMC._x=arrowX;
arrowMC._y=arrowY;
arrowMC._rotation=180;
}
if (this._x>StageWidth+(this._width/2)) {
this._x = 0-(this._width/2);
}
if (this._x<0-(this._width/2)) {
this._x = StageWidth+(this._width/2);
}
if (this._y>StageHeight+(this._height/2)) {
this._y = 0-(this._height/2);
}
if (this._y<0-(this._height/2)) {
this._y = StageHeight+(this._height/2);
}
}

player1.speed = 5;
player1.onEnterFrame = moveStuff;

[code]

it works fin but when we use the frase "gotoAndPlay" it doesn't it just goes to that frame and stops, can someon tell me whats wrong with it?

Error Code #1034
I am getting the following error code...does anyone know why the code that I am getting cannot be converted to XML?

I am downloading this DIRECTLY from eBay's API


Code:
TypeError: Error #1034: Type Coercion failed: cannot convert "<?xml version="1.0" encoding="UTF-8"?>

<FindItemsAdvancedResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2008-10-05T01:28:51.821Z</Timestamp>
<Ack>Success</Ack>
<Build>e585_core_Bundled_7338347_R1</Build>
<Version>585</Version>
<SearchResult>
<ItemArray>
<Item>
<ItemID>160288036936</ItemID>
<EndTime>2008-10-05T22:57:17.000Z</EndTime>
<ViewItemURLForNaturalSearch>http://cgi.ebay.com/Rapaport-Report-Diamond-Price-List-Guide-Save-Thousands_W0QQitemZ160288036936QQihZ006QQcategoryZ110739QQcmdZViewItem</ViewItemURLForNaturalSearch>
<ListingType>Chinese</ListingType>
<GalleryURL>http://thumbs2.ebaystatic.com/pict/1602880369368080_1.jpg</GalleryURL>
<PrimaryCategoryID>110739</PrimaryCategoryID>
<PrimaryCategoryName>Jewelry & Watches:Loose Diamonds & Gemstones:Diamonds (Natural):Round, Brilliant:1.50 to 1.99 carats</PrimaryCategoryName>
<BidCount>1</BidCount>
<ConvertedCurrentPrice currencyID="USD">0.99</ConvertedCurrentPrice>
<ListingStatus>Active</ListingStatus>
<TimeLeft>PT21H28M26S</TimeLeft>
<Title>Rapaport Report Diamond Price List Guide Save Thousands</Title>
<ShippingCostSummary>
<ShippingServiceCost currencyID="USD">0.0</ShippingServiceCost>
<ShippingType>Flat</ShippingType>
</ShippingCostSummary>
</Item>
</ItemArray>
</SearchResult>
<PageNumber>1</PageNumber>
<TotalPages>73</TotalPages>
<TotalItems>722</TotalItems>
<ItemSearchURL>http://jewelry.listings.ebay.com/_W0QQDemandDataZ1QQfsopZ32QQsacatZ10210QQsaprchiZ2Q2e0QQsaprcloZ0Q2e0QQsascsZ1QQsocmdZListingItemList</ItemSearchURL>
</FindItemsAdvancedResponse>
" to XML.

Error In Cluster Code
Hi,

I'm trying to cluster pictures on time, which means that if a picture is made within 5 min after the previous one, they will be clustered together, the more pictures, the larger the cluster. I've already have function that sorts the pictures into two groups namely clusterpics and doubtpics. doubtspics contains pictures that doesn't belong to the previous picture/cluster, but could belong to another cluster. Therefore it has to be checked wether the latter situation is true and if not, they have to become linepics. Now my error will be in the next code, where I want to seperate the doubtpics. The code does find that some doubtpics still belong to the clusterpics, but the weirdest part is that the other doubtpics won't become line pics.


Code:
function ClusterDoubtPics() {

var match = false;
var t:int = 0;
var u:int = 0;
var v:int = 0;
var w:int = 0;
var counter3 = 0;


for (t=0; t < doubtpics.length; t++) { // it is still possbile that there are clusterpics among the doubthpics so they have to be seperated.
match = false;

for (u=0; u < clusterPics.length; u++) { // it will run for each doubtpic

if (doubtpics[t] == clusterPics[u]) { // when there is a match
match = true;// doubtpic will become clusterPic
doubtpics[t] = clusterPics[u];
trace ("doubtpic " + clusterPics[u] + " is a clusterPic");
}
}
if (match == false) {// if not
doubtpics[t] = linePics[counter3]; // doubtpic will become a linePic
counter3++;
trace ("doubtPic"+ linePics[teller3] + " is a linePic");
}
}
}
There are eight doubtpics, of which 5 clusterpics and 3 linepics. When I trace I'll get the following result:

doubtpic IMG_3380.jpg is a clusterPic
doubtpic undefined is a linePic
doubtpic IMG_3386.jpg is a clusterPic
doubtpic IMG_3392.jpg is a clusterPic
doubtpic IMG_3396.jpg is a clusterPic
doubtpic undefined is a linePic
doubtpic IMG_3401.jpg is aclusterPic
doubtpic undefined is a linePic

these undefined should be pics 3384, 3400 and 3404, which means that the order is okay, but why does flash see them as undefined.

Find An Error In My Code
Hi, I know this is probably asking a lot but could someone check my code for errors?

The error is get is:

TypeError: Error #1010: A term is undefined and has no properties.
at mainFluid_fla::MainTimeline/giveFunction()
at mainFluid_fla::MainTimeline/frame1()



ActionScript Code:
var br:int=new int  ;
br=0;
//Draws dot
function drawParticle(colour) {
    br++;
    var particle:MovieClip=new MovieClip();
    particle.graphics.lineStyle(1,colour,100);
    particle.graphics.moveTo(0,0);
    particle.graphics.lineTo(1,0);
    particle.graphics.lineTo(1,1);
    particle.graphics.lineTo(0,1);
    particle.graphics.lineTo(0,0);
    particle.vrsta=colour;
    particle.eat=false;
    addChild(particle);
    particle.name="particle"+br;
}

//Makes dot a cell
function giveFunction(race,type) {
    if (race=="red") {
        drawParticle(0xFF0000);
    } else {
        drawParticle(0x0000FF);
    }
    if (type=="queen") {
        this["particle"+br].eat=false;
        this["particle"+br].addEventListener(Event.ENTER_FRAME,queen);
        function queen(evt:Event):void {
            if (this.eat==false) {
                getNearestPart(this,"e");
            }
        }

    }

}

//Returns nearest cell that is friendly or not depending on 'what'
function getNearestPart(who,what) {
    var min=999999999;
    var closest;
    for (var mc in Stage) {
        if (what=="e") {
            if (this[mc].vrsta!=who.vrsta) {
                if (getDistance(this[mc],who)<min) {
                    min=getDistance(this[mc],who);
                    closest=this[mc];
                }
            }
        } else if (what=="f") {

        }
    }
    return closest;
}

//Returns the distance of two objects
function getDistance(o1,o2) {
    return Math.sqrt(Math.pow(Math.abs(o1._x-o2._x),2)+Math.pow(Math.abs(o1._y-o2._y),2));
}

giveFunction("red","queen");
giveFunction("blue","queen");


It was all going smoothly when I got normal syntax errors and such and then this....
I'm new to AS3.0 and would appreciate any help.
Thanks ahead.

Custom Error Code
We are using server side action script to perform authentication to block certain users from streaming our videos.

We want to display a meaningful error message on the web page/flash player if the authentication fails. The manual briefly mentions that error status codes can be used for error-handling scripts. Can someone provide some more details? In our case, we want to have a custom error status code and somehow the status code can be propagated to the client such that the appropriate message can be shown. Thanks.

Code Error For Hyperlink
I am in flash 9 and creating a basic hyperlink on one of my text layers.
I converted the text to a button and then went to the actions panel and entered the following code:
on(release)
{
getURL("

Error Code For Hyperlink
I have a menu that is made out of a street sign. it is layered on top of my flash file. I created the flash and now need to do my hyperlinks for the menu within flash9. I did some more research on the internet for tutorials on creating buttons.

I created an invisible button over the text following this tutorial:
http://www.developingwebs.net/flash/...blebuttons.php

The only thing thas I'm confused with is that when I click on the button on the stage and then go to actions, I don't see the button on the menu on the left. I copy and past the following script:

getURL("http://www.southbridgesecurity.htm. ", "_self");


and it won't work. I never set the invisible buttons on any layer (I followed the tutorial to a "T".

Please help!!!! I'm so close to getting it finished but this is holding me up.

Thanks!

Code Error - All Help Needed´
Ok.. this is the END of the code (its not really mine..):

this.createEmptyMovieClip("pos", total);
pos.moveTo(radius.b, 0);
pos.beginGradientFill("radial", [0xCCCCCC, 0x999999], [100, 100], [0, 255], {matrixType:"box", x:-radius.b-radius.b/2, y:-radius.b-radius.b/2, w:radius.b*2, h:radius.b*2, r:0});
for (var radians = 0; radians


I get a error for the last line. The error is this:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 11: ';' expected
for (var radians = 0; radians

I cant get it working..
HELP!!!

I have flash mx 2004 pro.. that can be the problem, but can someone change it so it will work for my version if that is the problem ?

Compile Code Error
function test(id)
{
var m = id;
k = 0;
if (k < data.length)
{
} // end if
data[k] != m ? (k++) : ();
return(data[k] != m ? (k++) : ());
} // End of the function

I get this test function from a flash file. But i don't know why i can't compile it from Flash MX 2004 .

**Error** Symbol=Symbol 91, layer=Action Layer, frame=1:Line 8: Unexpected ')' encountered
dad[k] != m ? (k++) : ();
**Error** Symbol=Symbol 91, layer=Action Layer, frame=1:Line 9: ')' expected
return(data[k] != m ? (k++) : ());

Can anyone tell me what actually software to compile the above function which is understand ( ) ??

Using The Same Code Without Conflict Error?
in as 2.0, u could use the same code many times. i'm making a gallery, and i want to have many galleries. but when i copy my gallery code, it says "a conflict exists with definition"

how can you make many galleries without this error?

my galleries codes are in different frames.

Code Error - All Help Needed´
Ok.. this is the END of the code (its not really mine..):

this.createEmptyMovieClip("pos", total);
pos.moveTo(radius.b, 0);
pos.beginGradientFill("radial", [0xCCCCCC, 0x999999], [100, 100], [0, 255], {matrixType:"box", x:-radius.b-radius.b/2, y:-radius.b-radius.b/2, w:radius.b*2, h:radius.b*2, r:0});
for (var radians = 0; radians


I get a error for the last line. The error is this:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 11: ';' expected
for (var radians = 0; radians

I cant get it working..
HELP!!!

I have flash mx 2004 pro.. that can be the problem, but can someone change it so it will work for my version if that is the problem ?

Compile Code Error
function test(id)
{
var m = id;
k = 0;
if (k < data.length)
{
} // end if
data[k] != m ? (k++) : ();
return(data[k] != m ? (k++) : ());
} // End of the function

I get this test function from a flash file. But i don't know why i can't compile it from Flash MX 2004 .

**Error** Symbol=Symbol 91, layer=Action Layer, frame=1:Line 8: Unexpected ')' encountered
dad[k] != m ? (k++) : ();
**Error** Symbol=Symbol 91, layer=Action Layer, frame=1:Line 9: ')' expected
return(data[k] != m ? (k++) : ());

Can anyone tell me what actually software to compile the above function which is understand ( ) ??

Code Error With Flex ?
hi all

i have been trying to use flex 3 with flash CS3 in papervision but i had a problem why i don't know

the code :
Code:

package {
   import flash.display.Sprite;
   import flash.events.Event;
   
   import org.papervision3d.cameras.Camera3D;
   import org.papervision3d.materials.ColorMaterial;
   import org.papervision3d.objects.Plane;
   import org.papervision3d.scenes.Scene3D;

   public class asFlex extends Sprite
   {
      public function asFlex()
      {
         var sp:Sprite = new Sprite();
         this.addChild(sp);
         sp.x = stage.stageWidth * 0.5;
         sp.y = stage.stageHeight * 0.5;
         
         var scene:Scene3D = new Scene3D(sp);
         var camera:Camera3D = new Camera3D();
         var p:Plane = new Plane(new ColorMaterial(0x000000),200,200);
         scene.addChild(p);
         scene.renderCamera(camera);
         
         addEventListener(Event.ENTER_FRAME,go);
         
         private function go(e:Event):void{
            p.rotationY += 5;
         }
         
         }
      }
   }



i think i made it right but i have this error why i don't know !!!!!!!!!!!!!!
error :
Code:

1013: The private attribute may be used only on class property definitions.

this error goes when i delete the event listener and it's function

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