Solved

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

Posted on 2011-03-10
6
279 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

713 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