hoanganh17's Recent Forum Activity

  • 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..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • .cap are not compatible with C2 (which only opens .capx and .caproj).

    The tutorials for C2 are in the ... section of the site.

    You can also check the links in my signature for more informations and stuff about/for C2.

    Thank Kyatric

    Please tell my where I can down load CC to research about techniques of some very interesting like Fighter...3D tank...etc.

    I wanna apply them in C2 but have no clue..

    Best regards

  • I am new in Construct2 and very interesting with game creation in HTML5.

    Problems are while I am looking for solution from old tutorials in this forum -> a lot of useful things compressed with old version of Construct (under .cap file). I did try to open them but no way...:D.

    Could you guys tell me how to reuse this resource...?

    Thank in advance.

  • "Javascript error!

    SyntaxError: JSON.parse: unexpected character

    localhost/My_plugin.js, line 134"

    -------------------------------------------------

    I develop my Own plugin to connect my Gamer to server via webSocket. Everything working very smooth and stable in r95. But runtime err appear after I upgrade to r103.2.3404349. I did try the test but could not define problem. For example: If I write only JSON testing with bellow JavaScript code, it is working ok:

    <font color=blue>var _data = '{"firstName":"John" , "lastName":"Doe"}';

    var obj = JSON.parse(_data);                     

    alert(obj.firstName);</font>

    Once connect to my webSocket server, bellow message popup:

    <font color=red>"Javascript error!

    SyntaxError: JSON.parse: unexpected character localhost/My_plugin.js, line 134"</font>

    But actually with R95 - this problem never happen.

    My server using windown2003 and websocket server base on Fleck at:

    github.com/statianzo/Fleck

    Please help me..I don't wanna stay slickly in R95 forever...:(.

    Best regard..

    PS: the declaration of websocket in my own plug in like that

    <font color=blue>

    if(typeof(WebSocket) == "undefined" && typeof(MozWebSocket) == "undefined")

    return;

    var socket = this.socket;

    wsImpl = window.WebSocket || window.MozWebSocket;</font>

hoanganh17's avatar

hoanganh17

Member since 29 Jul, 2012

None one is following hoanganh17 yet!

Connect with hoanganh17

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies