Solved

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

Posted on 2011-03-10
6
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.

630 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