Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8436065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:05:18+00:00 2026-06-10T07:05:18+00:00

I am facing the problem when i am running this code in 5.0 but

  • 0

I am facing the problem when i am running this code in 5.0 but it’s working fine in 3.3.
I have set every thing but still it’s giving the problem. Am i doing this in a wrong way?

<canvas width="1000" height="584">

      <drawview width="200" height="300" 
              x="12" 
              y="12">
        <handler name="onwidth">
            this.redraw();
        </handler>
        <handler name="onheight">
            this.redraw();
        </handler>
        <method name="redraw">
            this.clear();
            var roundness = 5;
            this.beginPath();
            this.moveTo(roundness, 0);
            this.lineTo(this.width - roundness, 0);
            this.quadraticCurveTo(this.width, 0, this.width, roundness);
            this.lineTo(this.width, this.height - roundness);
            this.quadraticCurveTo(this.width, this.height, this.width - roundness, this.height);
            this.lineTo(roundness, this.height);
            this.quadraticCurveTo(0, this.height, 0, this.height - roundness);
            this.lineTo(0, roundness);
            this.quadraticCurveTo(0, 0, roundness, 0);
            this.closePath();

            var g = this.createRadialGradient(-this.width * .5, -this.height *.5, .7, 1.5 * this.width, 1.5 * this.height, 0)
            this.globalAlpha = 0;
            g.addColorStop(0, 0x000000);
            this.globalAlpha = 0.8;
            g.addColorStop(1, 0xffffff);

            this.setAttribute("fillStyle", g);
            this.fill();
        </method>
    </drawview>
</canvas>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:05:20+00:00Added an answer on June 10, 2026 at 7:05 am

    The onwidth and onheight handler are being called during the initialization of the drawview, at a point in time where the component initialization has not finished. If you check for the isinited attribute of a component, you can make sure that the redraw method is only called when the component is ready. I’ve added some debug output to this example to show you what’s happening:

    <drawview id="dv" width="100%" height="100%" 
          x="12" 
          y="12">
      <attribute name="isready" value="false" type="boolean" />
      <handler name="oncontext">
        this.setAttribute("isready", true);
        this.redraw();
      </handler>
      <handler name="onwidth">
        Debug.write('onwidth: calling redraw()');
        this.redraw();
      </handler>
      <handler name="onheight">
        Debug.write('onheight: calling redraw()');
        this.redraw();
      </handler>
      <method name="redraw">
        Debug.info('redraw: this.ininited=' + this.isinited + ' / isready=' + this.isready);
        if (this.isready) {
          this.clear();
          var roundness = 5;
          this.beginPath();
          this.moveTo(roundness, 0);
          this.lineTo(this.width - roundness, 0);
          this.quadraticCurveTo(this.width, 0, this.width, roundness);
          this.lineTo(this.width, this.height - roundness);
          this.quadraticCurveTo(this.width, this.height, this.width - roundness, this.height);
          this.lineTo(roundness, this.height);
          this.quadraticCurveTo(0, this.height, 0, this.height - roundness);
          this.lineTo(0, roundness);
          this.quadraticCurveTo(0, 0, roundness, 0);
          this.closePath();
    
          var g = this.createRadialGradient(-this.width * .5, -this.height *.5, .7, 1.5 * this.width, 1.5 * this.height, 0);
          this.globalAlpha = 0;
          g.addColorStop(0, 0x000000);
          this.globalAlpha = 0.8;
          g.addColorStop(1, 0xffffff);
    
          this.setAttribute("fillStyle", g);
          this.fill();
        }
      </method>
    </drawview>
    

    Edit: Updated the code support to use the oncontext event instead of isinited value

    I’ve checked the drawview documentation, and the drawview has a special event called the oncontext event. From the docs:

    The oncontext event is sent when the context is ready to use, which
    can take some time in IE DHTML.

    If you look at the drawview documentation in the OpenLaszlo reference, you’ll see that the examples use the oncontext event handler to draw into the canvas.
    I’ve updated my solution to use an additional attribute isready, which is set to true once the oncontext event has been received. As you can see in the debug output below, isinited is set to true before isready is set to true:

    onwidth: calling redraw() 
    INFO: redraw: this.ininited=true / isready=false 
    onheight: calling redraw() 
    INFO: redraw: this.ininited=true / isready=false 
    INFO: redraw: this.ininited=true / isready=true 
    

    If you compile your code with errors for the DHTML runtime, you should have seen the following warning:

    WARNING: this.context is not yet defined. Please check for the
    presence of the context property before using drawing methods, and/or
    register for the oncontext event to find out when the property is
    available.

    Unfortunately such a warning is not shown for the SWF runtime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

iam facing problem in passing array to view. this is my controller code.. function
I have AMQ + Activemessaging running in a Rails App. I'm facing a problem
I am facing a problem with BigDecimal. This code: x = BigDecimal.new('1.0') / 7
I am facing a strange problem while running my application. I have a class
Iam facing problem in understanding and converting a matlab code into opencv. I want
I am facing problem to get variable from query string. I have used htaccess
I am facing an issue with SecureRandom in java. This was the code that
I am facing this problem while installing extensions, themes basically anything from magento connect.
I'm facing a problem I have never had before. The other day when I
It's been now 1 week that I am facing this problem. I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.