hoanganh17's Forum Posts

  • Thank you ASHLEY.

    You give me very clear explanation.

    I will do a test again in my own server and give you a result tomorrow..

    Best regards

  • No, I don't think so

    1. You can see second image in case you post it's url in browser.

    2. If I change image ure (ie "http://www.psdgraphics.com/wp-content/uploads/2009/12/color-wheel.jpg"). The result is same (blank).

    3. In my browser have no error message on firebug...:)..???

    <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" />

    I still believe that the sprite have no redraw function after image is loaded already...???. I guess... <img src="smileys/smiley4.gif" border="0" align="middle" /> <img src="smileys/smiley4.gif" border="0" align="middle" />

    I did try this test many time with different image's url but same..

    Thank to0 much for your reply

  • ranma

    I followed your guideline but result have no changed...:(

    Here my capx

    dropbox.com/s/2yak3j892nb0v72/test2.capx

    Could you pls give me a sample capx to solve this problem...:)

  • Ashley thank so much for your reply

    But actually after I add more empty frame to sprite, the second instance of sprite after invoke LoadImage form URL and set frame to 1 have a blank image...

    Problem is not solved..

    Best regards

  • Before C2 have it own debugger..Hoping it have search feature to search and highlight object, action, event...etc.

    I really tired to read long and complicated event sheet.. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Thank ranma

    I do it follow your suggestion but problem still there..same image for instances of sprite after i add action sprit->set animation frame to 1..

    Actually after do a test (I add browser alert Sprite.AnimationFrameCount)

    AnimationFrameCount==1 this is meaning that there are no more frame for sprite after loading..

    I think sprite cannot redraw it self after image loaded already.

    Have you got some other way to walkthrough

    Thank in advance..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I am looking for solution to load Image from URL in run time but actually when using LoadImage from URL action of Sprite with different links...I have same Image ...???

    Step of reproduce here:

    System->OnStartLayout: Load image from URL ...."www.something.com"

    Button->OnClick: Create Sprite then Load image from URL ...."www.somethingelse.com"

    Result: Both image same from something.com

    Expected: Images must be different

    Link below is my testing capx.

    dropbox.com/s/d1dmzfpfqsg5kg5/test.capx

    Is this bug..??

    How do I solve this probplem..??

  • For more information

    The sprite at initial state have no image..

    I am going to use LoadImageFromURL in case above problem solved...

    Thank you very much...jsw@Ashley

  • Dear Ashley

    So I believe that there are something wrong with LoadImage from URL of Sprite...So sorry because I don't know how to post capx file...:) but steps of reproduced this bug like that

    System->OnStartLayout: Load image from URL ...."www.something.com"

    Button->OnClick: Create Sprite then Load image from URL ...."www.somethingelse.com"

    Result: Both image same from something.com

    Expected: Images must be different

    Thank you very much...

    PS: this is reason I can't using LoadImage from URL of Sprite component..

  • Dear Asley..thank for your reply...

    Actually in R95 my code work very fine....

    I cannot using the LoadImage from URL in sprite because this feature is working very bad in case of large image or low bandwidth work.

    It is meaning why I have to write my own plugin to get image.

    In my game...player have it own Avatar and sprite doesn't redraw image after it is loaded already...

    I just looking for solution for this problem...

    Hope you have some suggestion for me in these cases...

    Thank you very much.

  • I wrote a plugin to lazy load image from URL to prevent broken image in case of slow network..

    Everything are fine in r95. But in r114 my javascript code is broken..??

    Following this code:

    ///

    var c=document.getElementById("c2canvas");

    var ctx=c.getContext("2d");

    /////

    And the answer is ctx == null or undefined

    This is bug...???

    My code segment here

    <font color=RED>

    // draw myImage

         instanceProto.paint = function (myparam)

         {

          //alert("here: "+ this.runtime.id);      

          //alert(this.x);

          var _x = this.x;

          var _y = this.y;

          var _w = this.width;

          var _h = this.height;

            //this.runtime.trigger(pluginProto.cnds.ImageLoaded,instance);

            var image = new Image();

            image.src = myparam;           

           var c=document.getElementById("c2canvas");

           //var c = $("#c2canvas")[0>;        var ctx=c.getContext("2d");        if(c.getContext("2d")!=null){                image.onload= function(){                    ctx.drawImage(image, _x - _w/2, _y- _h/2, _w,_h);         }            //this.draw(con);            //this.runtime.redraw=true;         this.image = image;                }else{             alert("what the heck...??");         }      };      ////////////////////////////////////// So how do I solve this problem in case the runtime was changed...??? Thank in advanced

  • I really surprised...

    My plugin is worked very well in build r95..

    Problem comes after I attempt to update to r114.

    Javascript library don't recognize the context of element...???

    My code as bellow:

    <font color=RED>

         instanceProto.paint = function (myparam)

         {

          //alert("here: "+ this.runtime.id);      

          //alert(this.x);

          var _x = this.x;

          var _y = this.y;

          var _w = this.width;

          var _h = this.height;

            //this.runtime.trigger(pluginProto.cnds.ImageLoaded,instance);

            var image = new Image();

            image.src = myparam;               

            image.onload= function(){

                var c=document.getElementById("c2canvas");

                var con=c.getContext('2d');

                if(null == con){

                   alert("con is null");

                   return;

                }

                con.drawImage(image, _x - _w/2, _y- _h/2, _w,_h);

            }

               //this.draw(con);

               //this.runtime.redraw=true;

            this.image = image;

           

         };

    </font>

    In test bed, alert message always topup "con is null"...this problem never appeared in old build

    Some one please help me...how to solve this problem

    Thank in advance

  • Could you tell me how to use this effect...How do I import in CC2..

    So sorry but I am new in Construct

  • There are some problems in IID of sprite in R108.2

    Reproduced steps

    1. Add global number: index

    2. Add button in canvas, add sprite in canvas

    3. Add text in canvas.

    4. Add action in button onclick event:

        a. Create new sprite object with x = 100+ 25*index

        b. set text = sprite.IID.

    Expectation:

        text.text automatically increase from 0 to number of sprite object - 1.

    Fact:

        text.text always = 0

    Actually this problem never appear in R95.

    I hope this problem could be fixed as soon as possible.

    So sorry about my English.

  • Dear all experts in this forum.

    I am looking for solution that can provide popup menu for my player. I expect when player left/right click in my object instance, popup menu appear and provide appropriated actions for him.

    Have you got any best solution for this problems. I want to get some simplest popup menu from html dialog and could assets via one action in custom plugin..

    Sorry about my very bad English.

    Thank in advance.