You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by lizhi <sl...@qq.com> on 2016/05/21 02:14:36 UTC

why can not open this code?

https://github.com/matrix3d/spriteflexjs/blob/master/src/flash/display/BitmapData.as#L124

if i open,it is can not run



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
it is the old code.but simple,just one line
Sprite;
and get the error,can not show anything.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53180.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by Harbs <ha...@gmail.com>.
I’m getting the following error:

Incorrect number of arguments.  Expected 2
				tf.__draw(ctx);

From here:
			}else if(param1 is TextField){
				var tf:TextField = param1 as TextField;
				tf.__draw(ctx);

Which seems to be expecting a Matrix:

		public function __draw(ctx:CanvasRenderingContext2D, m:Matrix):void{
			for (var i:int = 0; i < lines.length;i++ ){
				SpriteFlexjs.renderer.renderText(ctx, lines[i], defaultTextFormat, m, worldAlpha, blendMode, transform.colorTransform, 0, i * int(defaultTextFormat.size));
			}
		}

Are you getting some other error? This seems to be a pretty straight-foward bug in your code.

Harbs

On May 21, 2016, at 10:04 PM, lizhi <sl...@qq.com> wrote:

> pls,
> https://github.com/mmauri/spriteflexjs/blob/master/test/src/TestBitmapDraw.as#L62
> 
> 
> 
> --
> View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53178.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
pls,
https://github.com/mmauri/spriteflexjs/blob/master/test/src/TestBitmapDraw.as#L62



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53178.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by Harbs <ha...@gmail.com>.
Hi Lizhi,

Do you have some sample code which runs it?

On May 21, 2016, at 5:18 PM, lizhi <sl...@qq.com> wrote:

> run-time error,pls run it.
> 
> 
> 
> --
> View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53175.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
thanks ,good idea!

https://github.com/matrix3d/spriteflexjs/wiki/how-run

is it this wiki ok?



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53208.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by jude <fl...@gmail.com>.
lizhi,
i and others may be able to help you if we knew how to setup the projects.
i've got flexjs setup correctly but i don't know how to run your project or
library. maybe if you were able to create a wiki page like this one
<https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=63406558>
that might help us know how to setup and run your project (i use flash
builder). then again, it might be obvious to everyone else how to test this
project.

On Wed, May 25, 2016 at 8:44 PM, lizhi <sl...@qq.com> wrote:

> yes,i will try.but i do not know.why no debug theyself of flexjs sdk
> developer?
> why not do not like check out the spriteflexjs code.and debug.
>
> it is a sdk bug,look at the bug,will improte the flexjs sdk.
>
> why not it just useful for myself?
>
>
>
> --
> View this message in context:
> http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53205.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.
>

Re: why can not open this code?

Posted by Alex Harui <ah...@adobe.com>.

On 5/26/16, 7:21 AM, "Andy Dufilie" <an...@gmail.com> wrote:

>On Wed, May 25, 2016 at 9:44 PM, lizhi <sl...@qq.com> wrote:
>
>> yes,i will try.but i do not know.why no debug theyself of flexjs sdk
>> developer?
>> why not do not like check out the spriteflexjs code.and debug.
>>
>> it is a sdk bug,look at the bug,will improte the flexjs sdk.
>>
>> why not it just useful for myself?
>>
>
>
>
>Because I have other obligations in both my personal and professional life
>at the moment and I'm currently not feeling well.  I thought it would be a
>valuable thing for you to learn how to debug an error in the browser if
>you
>did not already know.  It's much easier for you to test since you already
>have it up and running.  I just tried the build.bat and it did not work
>because test/src/Test3.as  does not exist in your repository.  It would be
>much easier for us to test if you provided a live demo like you have here:
>http://matrix3d.github.io/assets/html5/flexjsstage3d/bin/js-release/

For me, I thought it was common practice to reduce a potential bug down to
a simple test case.  For compiler/runtime issues, that generally involves
getting it down to as few files and lines of code as possible.  I quite
frequently request that folks reduce their code and attach it to a JIRA.
Reproducing a bug should not require cloning a repo.  The reduction helps
prove that the issue is not in your code, and it usually makes it easier
to describe the problem because the reduction only contains the code that
is truly involved.  And those who are going to diagnose and fix the
problem are more likely to do so when the test case doesn't contain a lot
of extra stuff.

And, as I said before, if you already have the information available to
you, just share it with us via copy/paste or screenshots.  Why should we
have to duplicate your work, find out we can't easily duplicate it and ask
questions for clarification?  Consider that each email is potentially read
by over 700 people.  That's a lot of community time consumed when the
information is not efficiently transmitted.

In general, if you report errors that contain line numbers, also share the
code at that line number, and other versioning related information like
which release or nightly build you are using if you have it.  I wish there
was an algorithm for "asking for help" that could guarantee capture of the
pertinent facts, but I think it remains an "art".  But especially when
there are language barriers, reduction to simple test cases, and
associating errors with lines of code helps because there is less words to
write:  just data to copy and paste.

Thanks,
-Alex


Re: why can not open this code?

Posted by Andy Dufilie <an...@gmail.com>.
On Wed, May 25, 2016 at 9:44 PM, lizhi <sl...@qq.com> wrote:

> yes,i will try.but i do not know.why no debug theyself of flexjs sdk
> developer?
> why not do not like check out the spriteflexjs code.and debug.
>
> it is a sdk bug,look at the bug,will improte the flexjs sdk.
>
> why not it just useful for myself?
>



Because I have other obligations in both my personal and professional life
at the moment and I'm currently not feeling well.  I thought it would be a
valuable thing for you to learn how to debug an error in the browser if you
did not already know.  It's much easier for you to test since you already
have it up and running.  I just tried the build.bat and it did not work
because test/src/Test3.as  does not exist in your repository.  It would be
much easier for us to test if you provided a live demo like you have here:
http://matrix3d.github.io/assets/html5/flexjsstage3d/bin/js-release/

Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
yes,i will try.but i do not know.why no debug theyself of flexjs sdk
developer?
why not do not like check out the spriteflexjs code.and debug.

it is a sdk bug,look at the bug,will improte the flexjs sdk.

why not it just useful for myself?



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53205.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by Andy Dufilie <an...@gmail.com>.
The way I would debug this is to open Chrome dev tools and enable "Pause on
exceptions" using the button circled here:
http://image.prntscr.com/image/dcc65ace5dd146718a7c608619b6521d.png

Just refresh the page after enabling that option and Chrome will show you
the stack trace of the error and allow you to look at the values.

Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
the same on remove super().
pls checkout the full code.
and run the build.bat.
it is realy easy build,youself.
thanks.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53202.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by Andy Dufilie <an...@gmail.com>.
I think Alex is right that the problem is your BitmapData.as constructor
calls super() yet the BitmapData class does not extend anything.  That
would explain the TypeError on line 2367 because parentCtor would be
undefined.

Try removing this line:
https://github.com/matrix3d/spriteflexjs/blob/master/src/flash/display/BitmapData.as#L23


On Tue, May 24, 2016 at 10:04 PM, lizhi <sl...@qq.com> wrote:

> goog.inherits = function(childCtor, parentCtor) {
>   /** @constructor */
>   function tempCtor() {}
>   tempCtor.prototype = parentCtor.prototype;//2367
>   childCtor.superClass_ = parentCtor.prototype;
>   childCtor.prototype = new tempCtor();
>   /** @override */
>   childCtor.prototype.constructor = childCtor;
>
> this is the base.js 2367 line etc.
>
> thanks.
>
>
>
> --
> View this message in context:
> http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53200.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.
>

Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
goog.inherits = function(childCtor, parentCtor) {
  /** @constructor */
  function tempCtor() {}
  tempCtor.prototype = parentCtor.prototype;//2367
  childCtor.superClass_ = parentCtor.prototype;
  childCtor.prototype = new tempCtor();
  /** @override */
  childCtor.prototype.constructor = childCtor;

this is the base.js 2367 line etc.

thanks.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53200.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by Andy Dufilie <an...@gmail.com>.
Hi lizhi,
Most of us read the forum via e-mail and the Nabble forum website does not
forward attached images through e-mail, so we did not realize you had
shared a screenshot.

From the screenshot, the errors are:
Uncaught TypeError: Cannot read property 'prototype' of undefined.
base.js:2367
Uncaught TypeError: flash.display.InteractiveObject.base is not a function.
InteractiveObject.js:21

In general you should investigate the first error that appears before you
look at any others. The one in base.js line 2367 likely causes everything
using the google closure framework to fail.  I've looked at my copy of
base.js and there is no code on that line, so I cannot know what is
happening from here.  You can try looking on line 2367 of your copy at
http://localhost:2000/bin/js-debug/library/closure/goog/base.js.

Andy

On Tue, May 24, 2016 at 9:34 PM, lizhi <sl...@qq.com> wrote:

> i have put the error png.it is there have some suggle?
>
>
>
> --
> View this message in context:
> http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53198.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.
>

Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
i have put the error png.it is there have some suggle?



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53198.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
yes,i can post the line num,and other thing.

but i Suggest check out the full source,and build it.it is easy build use
@Harbs is build code(mac),or use my build code(win).
<http://apache-flex-development.2333347.n4.nabble.com/file/n53188/bug.png> 



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53188.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by Alex Harui <ah...@adobe.com>.
Please post those files (2base.js and InteractiveObject.js) with line
numbers so we can see what the generated code is.

One thing I think I see that is odd with your code is that BitmapData.as
doesn't seem to have a base class but the constructor has a call to
super().

-Alex

On 5/22/16, 6:22 PM, "lizhi" <sl...@qq.com> wrote:

>and this code get this error.
>
>2base.js:2367Uncaught TypeError: Cannot read property 'prototype' of
>undefined
>InteractiveObject.js:21Uncaught TypeError:
>flash.display.InteractiveObject.base is not a function
>
>
>
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this
>-code-tp53169p53186.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
and this code get this error.

2base.js:2367Uncaught TypeError: Cannot read property 'prototype' of
undefined
InteractiveObject.js:21Uncaught TypeError:
flash.display.InteractiveObject.base is not a function



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53186.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by lizhi <sl...@qq.com>.
public function draw(source:IBitmapDrawable, matrix:Matrix = null,
colorTransform:ColorTransform = null, blendMode:String = null,
clipRect:Rectangle = null, smoothing:Boolean = false):void  {
			drawWithQuality(source, matrix, colorTransform, blendMode, clipRect,
smoothing);
		}
		
		public function drawWithQuality(source:IBitmapDrawable,
matrix:Matrix=null, colorTransform:ColorTransform=null,
blendMode:String=null, clipRect:Rectangle=null, smoothing:Boolean=false,
quality:String=null):void  {
			if (source is BitmapData){
				var bmd:BitmapData = source as BitmapData;
				fromImage(bmd.ctx);
			}else if(source is TextField){
				var tf:TextField = source as TextField;
				tf.__draw(ctx,matrix);
			}else if (source is Sprite){
				var sp:Sprite = source as Sprite;
				sp.graphics.draw(ctx, sp.worldMatrix, 1, sp.blendMode,
sp.transform.colorTransform);
			}else if (source is Shape){
				var sha:Shape = source as Shape;
				sha.graphics.draw(ctx, sha.worldMatrix, 1, sha.blendMode,
sha.transform.colorTransform);
			}
		}


pls use this code.

or just input a new matrix.

package 
{
	import flash.display.*;
	import flash.events.Event;

	public class TestDraw extends Sprite
	{
		public function TestDraw ()
		{
			var shape : Shape = new Shape ();
			shape.graphics.lineStyle (1, 0xFFFFFF, 0.5);
			shape.graphics.beginFill (0xFF0080, 0.75);
			shape.graphics.drawCircle (100, 100, 100);

			 //addChild (shape);

			var data : BitmapData = new BitmapData (300, 300, true, 0x800080FF);

			data.draw (shape);

			var bitmap : Bitmap = new Bitmap (data);

			bitmap.x = bitmap.y = 10;

			addChild (bitmap);

		/*
			stage.addEventListener (Event.RESIZE, resize);
		}

		private function resize (e : Event) : void
		{
			graphics.clear ();
			graphics.beginFill (Math.random () * 0xFFFFFF, 0.75);
			graphics.drawRect (10, 10, stage.stageWidth - 20, stage.stageHeight -
20);
		*/
		}
	}
}



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53185.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: why can not open this code?

Posted by Harbs <ha...@gmail.com>.
FWIW, I adjusted Lizhi’s bat scripts to a shell script to run the test on my Mac:

#set FLEX_HOME=d:/sdk/flexjs7
FLEX_HOME=/FlexSDK/FlexJSNightly
MXMLC_PATH="$FLEX_HOME/js/bin/mxmlc"
EXTERN_PATH="$FLEX_HOME/js/libs/js.swc"
main=TestBitmapDraw
# main=TestHungryHero
# main=TestByteArrayVSArray
# main=Main
# main=Test3

ARGS='-remove-circulars'
#ARGS='-debug=true -remove-circulars'
#ARGS='-remove-circulars -js-compiler-option="--compilation_level WHITESPACE_ONLY"'
$MXMLC_PATH $ARGS -external-library-path="$EXTERN_PATH" -compiler.source-path=../src src/$main.as -define=CONFIG::as_only,false -define=CONFIG::js_only,true

I checked the project out of Github, so I think it’s current.

If I’m understanding Lizhi correctly, the code should be run with the code commented out. When I do that, it compiles correctly, but I get a runtime error in the browser.

Th error is from here:
draw(tf,bmd);

Which calls TextField.__draw() with a null Matrix. This causes a runtime error in renderText() because it’s expecting a non-null Matrix.

Again, this seems to be a bug in Lizhi’s code.

BTW, it’s much easier to see the problem in Chrome than Firefox because Chrome breaks at the error and shows the call stack.

Lizhi, if I’m missing something, please include that screenshot so we can understand.

On May 22, 2016, at 8:12 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 5/21/16, 3:25 PM, "Andy Dufilie" <an...@gmail.com> wrote:
> 
>> Copying and pasting error messages may help. Screenshots may help as well.
> 
> Exactly.  No need to write more words.  Just copy and paste console output
> or link to screenshots of runtime errors.  And link to small test cases.
> Especially on weekends, if I only have a few minutes to spare, if you can
> save me time, I'll probably save you time by having an informed thought.
> If I need to spend those few minutes trying to create your scenario, I
> will likely run out of time.
> 
> -Alex
> 


Re: AW: AW: why can not open this code?

Posted by Alex Harui <ah...@adobe.com>.

On 5/21/16, 3:25 PM, "Andy Dufilie" <an...@gmail.com> wrote:

>Copying and pasting error messages may help. Screenshots may help as well.

Exactly.  No need to write more words.  Just copy and paste console output
or link to screenshots of runtime errors.  And link to small test cases.
Especially on weekends, if I only have a few minutes to spare, if you can
save me time, I'll probably save you time by having an informed thought.
If I need to spend those few minutes trying to create your scenario, I
will likely run out of time.

-Alex


Re: AW: AW: why can not open this code?

Posted by Andy Dufilie <an...@gmail.com>.
Copying and pasting error messages may help. Screenshots may help as well.

Andy

On May 21, 2016 5:44 PM, "lizhi" <sl...@qq.com> wrote:
>
> i want push more details.
> but i do not speak english good.
> so i can not get the details.
> i am sorry.
>
.

Re: AW: AW: why can not open this code?

Posted by lizhi <sl...@qq.com>.
i want push more details.
but i do not speak english good.
so i can not get the details.
i am sorry.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53181.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: AW: AW: why can not open this code?

Posted by Alex Harui <ah...@adobe.com>.
Please save us the time of setting up a test case and provide more details.

Sent from my LG G3, an AT&T 4G LTE smartphone

------ Original message------
From: lizhi
Date: Sat, May 21, 2016 7:54 AM
To: dev@flex.apache.org;
Subject:Re: AW: AW: why can not open this code?

run-time error,pls run it.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53175.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: AW: AW: why can not open this code?

Posted by lizhi <sl...@qq.com>.
run-time error,pls run it.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53175.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: AW: AW: why can not open this code?

Posted by Alex Harui <ah...@adobe.com>.
What should the base class be?

Are you getting compile-time or run-time error?

-Alex

On 5/21/16, 12:45 AM, "lizhi" <sl...@qq.com> wrote:

>hi,pls commented in yourself.
>if i commented in can not get base class.
>in github i commented out,bcs the error.
>
>
>
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this
>-code-tp53169p53173.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: AW: AW: why can not open this code?

Posted by lizhi <sl...@qq.com>.
hi,pls commented in yourself.
if i commented in can not get base class.
in github i commented out,bcs the error.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53173.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

AW: AW: why can not open this code?

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi,

The entire code in the method you references is commented out. So there is nothing to execute. You also don't have to look at the base class, as the code is re-defining the method with an empty one and therefore nothing is executed.

Chris
________________________________________
Von: lizhi <sl...@qq.com>
Gesendet: Samstag, 21. Mai 2016 09:03:45
An: dev@flex.apache.org
Betreff: Re: AW: why can not open this code?

if not can not find the base class
try the code pls.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53171.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: AW: why can not open this code?

Posted by lizhi <sl...@qq.com>.
if not can not find the base class
try the code pls.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53171.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

AW: why can not open this code?

Posted by Christofer Dutz <ch...@c-ware.de>.
Because it's commented out?

Chris



Von meinem Samsung Galaxy Smartphone gesendet.


-------- Ursprüngliche Nachricht --------
Von: lizhi <sl...@qq.com>
Datum: 21.05.16 04:51 (GMT+01:00)
An: dev@flex.apache.org
Betreff: why can not open this code?

https://github.com/matrix3d/spriteflexjs/blob/master/src/flash/display/BitmapData.as#L124

if i open,it is can not run



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.