Skip to main content
Inspiring
November 12, 2006
Question

Video object _width property

  • November 12, 2006
  • 4 replies
  • 538 views

Hi all,

I have a class which has a private property 'screen' containing a
reference to a Video object like:

private var screen:Video;

A few lines below there's a public method returning the width of the
video object:

public function getWidth():Number{
return this.screen._width;
}

Now, when I compile I get the following error:

**Error**
D:\aloft\FlashLibrary\current\nl\aloft\media\phpflv\ScreenView.as: Line
35: There is no property with the name '_width'.
return this.screen._width;

However, when i run the code and call the method I get the width of the
object without any problems.

If I have the method return any of the properties without the underscore
(like: width, smoothing, deblocking etc.) I get no compile error.

What am I missing here?

Thanks in advance,
Manno

--
----------
Manno Bult
manno@xs4all.nl
This topic has been closed for replies.

4 replies

Inspiring
November 15, 2006
Hi myIP
thanks for the heads up,

I've found an ugly hack though:
The anonimous function in the init method compiles without error and
works, like the one below it, as expected. For now I'm OK with it, but
it annoys me pretty much. Maybe later I'll look into it deeper at a
later time (and post it here). Must be something silly...

private function init(target:MovieClip,
depth:Number,
ns:NetStream){
//... more code here

this.update = function(){
this.screen._width = this.screen.width;
this.screen._height = this.screen.height;
};
}

public function update(){
this.screen._width = this.screen.width;
this.screen._height = this.screen.height;
}


myIP wrote:
> Now I fully understand your question. I don?t know why that is and I am curious myself. Hopefully someone will post something about it.

--
----------
Manno Bult
manno@xs4all.nl
Inspiring
November 15, 2006
Now I fully understand your question. I don’t know why that is and I am curious myself. Hopefully someone will post something about it.
Inspiring
November 12, 2006


myIP wrote:
> The ?_width? property is used to assign the video a value or transform the
> video to whatever value. The ?width? property is a read-only property. It
> will simply just return the current width of the video. Look at the example in
> the link below;

I know the distinction between the two, I was only wondering why it
gives compiletime errors when referring to the "_width" property (whith
preceding underscore) and not when referring to the "width" property.
Though representing different properties, they are both _valid_ properties.

The error makes no sense to me really since the _width property does
exist while it claims it does not...

Manno



--
----------
Manno Bult
manno@xs4all.nl
Inspiring
November 12, 2006
The “_width” property is used to assign the video a value or transform the video to whatever value. The “width” property is a read-only property. It will simply just return the current width of the video. Look at the example in the link below;

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002848.html