• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

FB 4.5: Flash Professinal Project - Access to undefined property

Explorer ,
Jun 14, 2011 Jun 14, 2011

Copy link to clipboard

Copied

I have a "Flash Professinal Project" in my Flash Builder. So, I have a FLA file with the scene and some symbols on it. And a pack of AS files with code.

The trouble is with symbols in FLA file.

For example, I have a movieclip with instance name "dlg" on my scene.

And when I try to access this movieclip like "dlg.gotoAndStop(2)" in some code, the Flash Builder 4.5 underlines "dlg" and puts the orange question mark to the left saying "Access to undefined property dlg". Of course, FB doesn't know about existance of this movieclip. But 4.0 version didn't underline it orange.

Project compiles ok, but some code parts looks very annoying.

Half of my code looks like this:

fberr.png

The additional uncomfortable thing is that when I use FB4 and type dlg. , it opens the autocomplete dialog assuming that "dlg" is a MovieClip by default. FB4.5 doesn't do autocomplete even after I type "dlg.gotoAndS" and press "Ctrl+Space".

So, is there any way to get rid of this annoying orange question makrs? Maybe, there's a way to describe such instances specially for FB so it can find out their existance? Or just return the way it was in 4.0 ?

Views

3.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 16, 2011 Aug 16, 2011

Copy link to clipboard

Copied

If you are in the Flash Professional IDE and you put a movieclip instance directly on the stage and give that instance a name like "dlg" only the Flash IDE will know that this "dlg" movieclip is there wheras Flash Builder won't regonize it.

This is because as default, the Flash IDE declares all its stage instances automatically. You can chance this behavior in the ActionScript 3 settings which is located inside the publish settings. Hope my screenshot may help a little, because unfortunately I'm using the german version 😉

Uncheck_declare_stage_instances_automatically.png

Once this is done, you'll see that now also the Flash IDE throws an "ReferenceError: Error #1056:" that the property dlg could be accessed when you try to compile again.The yellow questionsmarks are indicating exactly that Error when you open your document class in Flash Builder.

The problem is that there is now a movieclip instance on the stage which haven't been declared before.

How do we declare it? The same way you usualy declare other class variables 😉

To Fix this problem and get full syntax highlighting in Flash Builder, open your document class and declare all MovieClip instances that you have on your stage:

Example:

public class SlideShow extends Sprite {
          //********************
          // Properties:
          public var slideShowDataURL:String = "assets/images.xml";
          public var slideShowDelay:uint = 6000;
         
          // Movieclips on Stage:
          public var captions_mc:CaptionBar;
          public var slideShow_mc:PhotoGallery;
          public var playPause_btn:Button;
          public var prev_btn:Button;
          public var next_btn:Button;
          public var fullScreen_btn:Button;
          public var timer_mc:TimerDisplay;
          public var footer_mc:MovieClip;
          public var dlg:MovieClip;

Be sure that the stage instances are declared as "public".
I don't know exactly why this public namespace is forced but it might have something to do with the instantiation process. Normaly you would create an instance of a moviclip by doing

var dlg:Movieclip = new MovieClip();

but this time you created an instance of a MovieClip by drag its movieclip-symbol from the library and drop it on the stage giving it an instance name "dlg". Probably because these movieclip is totally accessible it need to be declared as "public".

I hope could help.

Mit freundlichen Grüßen

ASEITZ

PS:

Additional solution to yellow questionmarks in Flash Builder:

I have had some problems with these yellow questionmarks in Flash Builder 4.5 when I tried out the new project panel workflow described at

http://www.adobe.com/devnet/flash/articles/flash_project_panel.html

No matter what I tried FB didn't give me CodeCompletion and marks even standard classes like MoviClip or Sprite as unknown.

Unkown_classes_in_FlashBuilder.png


The discribed worklow of FB IDE and Flash IDE doesn't make much sense when your FB doesn't know about these classes and you have yellow questionmarks all over the code...

I figured out that the problem is located inside the .actionScriptProperties file which should be found inside your project folder.

Make sure that inside the <compiler> tag the <libraryPath> is set to something simlar as the following:

<libraryPath defaultLinkType="0">
  <libraryPathEntry kind="3" linkType="1" path="${FLASHPRO_APPCONFIG}/ActionScript 3.0/FP10.2/playerglobal.swc" useDefaultLinkType="false"/>
  <libraryPathEntry kind="1" linkType="1" path="${FLASHPRO_APPCONFIG}/ActionScript 3.0/libs"/>
  <libraryPathEntry kind="3" linkType="1" path="${FLASHPRO_APPCONFIG}/ActionScript 3.0/libs/11.0/textLayout.swc" useDefaultLinkType="false"/>
  <libraryPathEntry kind="3" linkType="1" path="${FLASHPRO_APPCONFIG}/ActionScript 3.0/AIR2.6/airglobal.swc" useDefaultLinkType="false"/>
</libraryPath>


The yellow questionmarks should now disappear and CodeCompletion should work as expected.

😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2011 Nov 29, 2011

Copy link to clipboard

Copied

Hi, all!

Iam trying to follow AlexanderSeitz's instructions at the end of his reply regarding the .actionScriptProperties file. I am using Flash Builder 4.5.1 and don't see the .actionScriptProperties file in the project folder.

I  really want to get this resolved. Code completion is invaluable, and having tons of useless warnings are a major distraction. I hope that someone here can help me with this, before I go insane!

Thanks!

Pete

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2011 Nov 29, 2011

Copy link to clipboard

Copied

LATEST

Ok, I have finally found my issue. the "switch" syntax must have changed somewhere between Flex Builder 3 and Flash Builder 4.5.1

This used to work in Flex Builder 3. The 'case "t", "tr"' will cause code completion to stop working, and also give the "?" warnings all over the souce. Jusr use a separate line for each "case" fixed the issue.

This has been extremely frustrating for me, I don't have a half a day to google all over with no luck. I wound up making a copy of the project and commenting out most of the code a bit at a time to find this. Sure hope this helps someone else out there!

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                                                     xmlns:s="library://ns.adobe.com/flex/spark"

                                                     xmlns:mx="library://ns.adobe.com/flex/mx"

                                                     invoke="onInvoke(event);"  >

  <fx:Script>

                    <![CDATA[

                              private function onInvoke(invokeEvent:flash.events.InvokeEvent):void {

                                        var s:String;

                                        try {

                                                  switch ( s.toLowerCase() )

                                                  {

                                                            case "t", "tr":

                                                            case "trace":

                                                                      s = "trace";

                                                                      break;

                                                            case "l":

                                                            case "log":

                                                                      s = "log";

                                                                      break;

                                                            default:

                                                                      s = "?";

                                                                      break;

                                                  }

                                        }

                                        catch ( err:Error ) {

                                                  s = "error";

                                        }

                              }

                    ]]>

  </fx:Script>

  <fx:Declarations>

  </fx:Declarations>

</s:WindowedApplication>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines