frcol's Forum Posts

  • Ok rexrainbow

    I´ll update here.

  • [quote:h2netk0l]"The main thing is to always use dot syntax (Object.property) rather than bracket syntax (Object["property"]) in your own code. All properties using dot syntax are changed by Closure Compiler, but none of the properties in bracket syntax are changed."

    https://www.scirra.com/manual/22/runtime-overview

    Is it telling to always use dot syntax or I misundestood??

    I remember that i´ve read somewhere about it (the reason I´m using dot).

    The same time that it tells to use just dot syntax, the next sentence tells that dot syntax is changed when minified but bracket syntax not.

  • Yep!

    Thanks rexrainbow!

  • Nope.

    cr.logexport(request["responseText"]);
    cr.logexport(self.dataJson);
    self.dataJson = JSON["parse"](request["responseText"]);
    cr.logexport(self.dataJson.logradouro);[/code:3kq8rdks]
    first line returns
    
    [code:3kq8rdks]{
      "cep": "18061-000",
      "logradouro": "Rua Humberto de Campos",
      "complemento": "",
      "bairro": "Jardim Zulmira",
      "localidade": "Sorocaba",
      "uf": "SP",
      "ibge": "3552205",
      "gia": "6695"
    }[/code:3kq8rdks]
    Second line returns "Object {}"
    Fourty line returns "undefined"
    
    Works in preview, but not when exported for HTML5
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks R0J0hound, just perfect!

    The problem was the nested function.

    When "this" is inside a nested expression function (example called "A"), that is inside the "instanceProto" function, Calling the "A" function will get you the global object, in Strict mode, undefined (that was the trick part). That´s the reason for defining the "self"...you are right.

  • rexrainbow

    I implemented 2 new properties, 1 Condition and 1 expression:

    properties:

    • Show Info: informations that appears on top of the video
    • Dissable keyboard: enable/disable keyboard to play/pause/forward etc

    condition:

    • onError: If the video return any error (2, 5, 101, 150), the plugin is triggering it now.

    expression:

    • ErrorMessage: brings the error number (works just using the ID property in edit mode, if loads the video by "load video" on runtime, it returns 150 most time).

    Demo: http://fabiocolombini.comli.com/youtube/

    Download: http://fabiocolombini.comli.com/youtubePlugin/youtube.rar

    If you wanna take a look at it, I commented all my modifications with "frcol".

    I really hope you don´t care about it. I just needed these functionallities and implemented. So, if I have it working, the best thing to do is share it. And I think it´s not fair to rename it and put in another place for downlaod, because all the credits is for you. If somehow you don´t like it, just tell me what to do.

    I REALLY aprecciate your work and wanna humbly help.

    MaorKeshet

    1- I think it´s not possible because it´s a DOM element <iframe>

    2- I think it´s working.

    3- The click on the video, i think it´s not possible. I didn´t find anything about it in Youtube API.

  • Studying the AJAX plugin as refence, i found "lastData" in 3 situations:

    Code 1

    pluginProto.Instance = function(type)
    	{	
           ...
    		this.lastData = "";[/code:3l7lvv5y]
    
    Code 2
    [code:3l7lvv5y]
    var theInstance = null;
    
    window["C2_AJAX_DCSide"] = function (event_, tag_, param_)
    	{
             ...
    			theInstance.lastData = param_;
    	}
    
    instanceProto.onCreate = function()
    	{
    		theInstance = this;
    	};
    [/code:3l7lvv5y]
    
    Code 3
    [code:3l7lvv5y]
    var self = this;
    
    var errorFunc = function ()
    		{
        self.lastData = data.replace(/\r\n/g, "\n")[/code:3l7lvv5y]
    
    Code 4
    [code:3l7lvv5y]Exps.prototype.LastData = function (ret)
    	{
    		ret.set_string(this.lastData);
    	};[/code:3l7lvv5y]
    
    The first 2 codes I think it´s talking about the "Instances" propertie (between the 3 Classes: Plugin, type and Intance).
    
    Why in code 3 is using "self" ?
    
    In code 4 the "this.lastData" refers to the instace too?
  • Great rexrainbow!

  • Hi rexrainbow,

    Do you think the plugin could:

    • hide control bar (user cannot play, stop, go forward by controls)
    • detect if link is broke
  • Is there a better way to get json content inside a plugin that works when exported or is common to use JSON.parse(request.responseText)?

  • One solution is to put all numbers assigned in a array and each time you random a new number, you verify if it exists in the array yet, if not, put it in the array.

  • luizgama, great game!!

  • Hi planetserve, there is something called "Flow theory" https://en.wikipedia.org/wiki/Flow_(psychology). Take a look at the game section: balance of skill and challenge.

    Sometimes, if the game is to hard in the initial stage, the player does not have chance to get skills to play it and they can go away too soon. It´s not really a rule

    But it´s cool!

  • Am I doing something wrong?

    In preview it works, but when export, the json contents it´s not showed in the line marked below.

    Acts.prototype.LoadAddress = function (zipcode){
          var request = new XMLHttpRequest();
    		request.open('GET', '//viacep.com.br/ws/'+zipcode+'/json/', true);
    
    		request.onload = function() {
    			cr.logexport(request.status); // 200
    			if (request.status >= 200 && request.status < 400) {
    				cr.logexport(request.responseText); // show json content
    				this.dataJson = JSON.parse(request.responseText);
    		----> cr.logexport(this.dataJson.logradouro); // undefined when exported[/code:1yldme68]
    
    Demo: [url]http://kiduca.com/frc/zipcodePlugin/[/url]
    When click in "Find address", the form should be loaded with the address from zip code.
  • Is there another way that user can enter text besides HTML-element?

    Into Canvas?