Solved

What does this error mean and how do I fix it?

Posted on 2011-03-10
6
276 Views
Last Modified: 2012-06-27
I'm trying to make an flv preloader work. The code is below. I got it from the internet and while it seems sound, I get this this error:

1071: Syntax error: expected a definition keyword (such as function) after attribute url, not here.
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("Showdown_1.flv"); //your flv URL HERE
url here

this.createTextField("loaded_txt", this.getNextHighestDepth(), 10, 10, 160,
22);
this.createEmptyMovieClip("progressBar_mc", this.getNextHighestDepth());
progressBar_mc.createEmptyMovieClip("bar_mc",
progressBar_mc.getNextHighestDepth());
with (progressBar_mc.bar_mc) {
beginFill(0xFF0000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
endFill();
_xscale = 0;
}
progressBar_mc.createEmptyMovieClip("stroke_mc",
progressBar_mc.getNextHighestDepth());
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0x000000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
}

var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded/my_ns.bytesTotal*100);
loaded_txt.text = Math.round(my_ns.bytesLoaded/1000)+" of
"+Math.round(my_ns.bytesTotal/1000)+" KB loaded ("+pctLoaded+"%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded>=100) {
clearInterval(loaded_interval);
nextScene();
}
}

Open in new window

0
Comment
Question by:brucegust
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:sweeps
ID: 35098229
You have:      stream_ns.play("Showdown_1.flv"); //your flv URL HERE

stream_ns.play('http://mywebsite/flash/Showdown_1.flv'); //your flv URL HERE

I think it needs to know where to get it
0
 
LVL 16

Expert Comment

by:sjklein42
ID: 35098255
You have, on line 6, "url here".

Remove this line.
0
 

Author Comment

by:brucegust
ID: 35098354
OK, the corrected code is attached:

And here are my error messages:

line 35: 1095: Syntax error: A string literal must be terminated before the line break.
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("http://www.countryshowdown.com/Showdown_1.flv"); //your flv URL HERE
this.createTextField("loaded_txt", this.getNextHighestDepth(), 10, 10, 160,
22);
this.createEmptyMovieClip("progressBar_mc", this.getNextHighestDepth());
progressBar_mc.createEmptyMovieClip("bar_mc",
progressBar_mc.getNextHighestDepth());
with (progressBar_mc.bar_mc) {
beginFill(0xFF0000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
endFill();
_xscale = 0;
}
progressBar_mc.createEmptyMovieClip("stroke_mc",
progressBar_mc.getNextHighestDepth());
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0x000000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
}

var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded/my_ns.bytesTotal*100);
loaded_txt.text = Math.round(my_ns.bytesLoaded/1000)+" of
"+Math.round(my_ns.bytesTotal/1000)+" KB loaded ("+pctLoaded+"%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded>=100) {
clearInterval(loaded_interval);
}
}

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
ID: 35098421
Yes.  Line 35 got split into lines 35 and 36.  

Replace 35 and 36 with this:

loaded_txt.text = Math.round(my_ns.bytesLoaded/1000)+" of "+Math.round(my_ns.bytesTotal/1000)+" KB loaded ("+pctLoaded+"%)";

Open in new window

0
 
LVL 16

Expert Comment

by:sjklein42
ID: 35098435
Lines 6 and 7 got split, too, in your latest version.

What are you dloing to make this happen?  Cut-and-paste problems?
0
 

Author Comment

by:brucegust
ID: 35115795
OK, no more script errors, as far as the code being sound.

But now I'm getting a list of other things that I don't understand.

line 35 - 1120 Access of undefined property loaded_txt
line 10,11,21,22,23,36 - 1120: Access of undefined property progressBar_mc
line 4, - 1120 Access of undefined property my_video
line 6,8 - Warning: Warning: 1060: Migration issue: The method getNextHighestDepth is no longer supported.  Use DisplayObjectContainer.numChildren instead. DisplayObjectContainer.addChild always adds the new child to index DisplayObjectContainer.numChildren..
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Embedding Flash App/Movie on Website 3 488
ActionScript 3 - Removing Duplicates in ArrayCollection 1 350
Begin mp4 video on first frame 6 166
Actionscript in Flash 3 44
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now