Copy link to clipboard
Copied
access of undefined property variable01.
access of undefined property pattern.
I don't see a problem with the code, yet the error persists.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="init(event);"
minWidth="955" minHeight="600" backgroundColor="#cbd8e6">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
var variable01:String;
variable01 = "1";
var pattern:RegExp;
pattern = /^[0-9]{1,3}$/;
pattern.test(variable01);
]]>
</fx:Script>
</s:Application>
When using Flex you can't just put code in a script tag like this. While declarations (public var etc) can be in this scope, logic must be inside an event handler.
See my answer in this thread:
Copy link to clipboard
Copied
When using Flex you can't just put code in a script tag like this. While declarations (public var etc) can be in this scope, logic must be inside an event handler.
See my answer in this thread:
Copy link to clipboard
Copied
Thanks for your help. I will study the creationComplete event and try it.