Scale and dynamic load

I'm working on a mini project.

Here was my original goal: "to produce a parent .swf which loads dynamically an image has a preloader for this external image, to show how much has loaded and finally and above all for this position, to be able to put this image when the size of the scene is changed"

That's what I come up with so far:

DYNAMIC LOADER

var homeimageLoader:Loader = new Loader();

var homeimage:URLRequest = new URLRequest ("image.jpg");

homeimageLoader.load (homeimage);

PRELOADER

homeimageLoader.addEventListener (Event.ENTER_FRAME, homephotoLoading);

function homephotoLoading(e:Event):void {}

var total: Number = homeimageLoader.contentLoaderInfo.bytesTotal;

var loaded: number = homeimageLoader.contentLoaderInfo.bytesLoaded;

loadBar.scaleX = loading/total;

if (total == load) {}

addChild (homeimageLoader);

homeimageLoader.x = 0;

homeimageLoader.y = 0;

SCALING OF THE IMAGE

homeimageLoader.width = Math.round((stage.stageWidth/2)+(stage.stageWidth/3));

homeimageLoader.height = Math.round((stage.stageHeight/2)+(stage.stageHeight/3));

(homeimageLoader.scaleX < homeimageLoader.scaleY)? homeimageLoader.scaleY = homeimageLoader.scaleX: homeimageLoader.scaleX = homeimageLoader.scaleY;

this.removeEventListener (Event.ENTER_FRAME, loading);

}}

It actually works very well...

My problem is the scaling section.

Because the image will load dynamically, it's pretty glitchy on a scale comparable to that of a picture that has been placed, for example, in the library or is placed on the floor.

If anyone knows how I can change my code so far, and from scratch to produce the same leaders, so that the scale is smooth, I would really appreciate it!

Thank you much, long in advance.

use:

DYNAMIC LOADER

var homeimageLoader:Loader = new Loader();

var homeimage:URLRequest = new URLRequest ("image.jpg");

homeimageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,homephotoLoading);homeimageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);

homeimageLoader.load (homeimage);

PRELOADER

function homephotoLoading(e:Event):void {}

var total: Number = homeimageLoader.contentLoaderInfo.bytesTotal;

var loaded: number = homeimageLoader.contentLoaderInfo.bytesLoaded;

loadBar.scaleX = loading/total;

If (total == load) {}

Remove your preloader display

addChild (homeimageLoader);

homeimageLoader.x = 0;

homeimageLoader.y = 0;

}

}

SCALING OF THE IMAGE

function completeF(e:Event):void {}

homeimageLoader.width = Math.round((stage.stageWidth/2)+(stage.stageWidth/3));

homeimageLoader.height = Math.round((stage.stageHeight/2)+(stage.stageHeight/3));

(homeimageLoader.scaleX< homeimageloader.scaley="" )="" homeimageloader.scaley="homeimageLoader.scaleX" :="" homeimageloader.scalex="">

}

Tags: Adobe Animate

Similar Questions

  • Question about the Manager of messages in queue and dynamically load/close Subvi

    Hi, my dear LV users

    I learn how to use the machine in queue Sate Architecture. I created a simple project, including a "main.vi" to dynamically load a sub vi 'sub_Vi2.vi' in the case of "initialize". The sub vi simply open a configuration file and load affecting some control and write these values in the configuration file. If the configuration file is not created, the sub vi creates until the user closes the Subvi.

    In the case of "Get out" of my "main.vi", I send 'true' to the Subvi stop button to stop running it. But the sub vi did not write these values back to the configuration file, or created a new when I delete the configuration file.

    There is another vi I made 'main1.vi', which loads dynamically and close the Subvi. And it works as well as I expected: create the file and write data!

    Can someone help me understand the code? I've also attached the front of diagrams and source code. It's in 2012 LV.

    Best regards

    Li CQ


  • Dynamically loaded Bitmapdatas zip are not approved locally and therefore cannot be changed

    It is a very strange problem.

    I use external resources to a game that I do. One of the resources is a zip file containing 100 images (thumbnails). The goal of this zip is simply that he would load these resources much easier, simpler and as I am storing these resources on Amazon S3, significantly cheaper.

    He worked without a hitch, until I moved and ran the swf in a location not approved.

    Now, when I try to load the first thumbnail I get this:

    Charger/get content())

    SecurityError: Error #2148: SWF file file:///C|/Users/Tom/Desktop/Jigsaw.swf cannot access the resource local file:///C|/Users/Tom/Desktop/Jigsaw.swf/[[DYNAMIC]]/1. Only SWF files local local - with system files and trust can access local resources.

    This happens when I try and access Loader.content, I need to do what some bitmapdatas will have to be changed after loading.

    I ran into a similar error when you try to originally load external resources and convert them into bitmapDatas. This has been fixed by using a policy file.

    I thought the policy file was the problem, but then I tried to integrate the .zip in the swf file rather than load it externally, like this:

    [Embed (source = "... / res/images/thumbnails.zip", mimeType = "application/octet-stream" "")]

    But even that threw up the same error.

    What is happening is that a byteArray is skillfully transposed in a BitmapData, but in the process, it becomes not approved by Flash.

    I can't find any way to convert this byte.

    I tried using several different class zip as3 packages, but they all fall into the same obstacle.

    Here's the key code:

    zip: FZip var = new FZip();

    zip.loadBytes (zipData);

    var file:FZipFile = zip.getFileByName ("image1.jpg");

    var loader: Loader = new Loader();

    loader.loadBytes (file.content);

    root.addChild (loader);

    loader.addEventListener ("click", Function {}

    var bd:BitmapData = e.target.content.bitmapData;

    bd.applyFilter (bd, bd.rect, new focus(), new BlurFilter (20, 20, 1));

    } );

    This is the part that is really weird... When I test it, it works fine, when I download online, very well. The only time I get the error is when the SWF file is run locally, but in an untrusted location.

    Obviously, these security measures are a bit blurry if it works without a hitch in line, but does not on-site, expect that it is the other way around.

    As far as I know there's nothing potentially dangerous with my code. It is from a trusted location (the policy file works).

    I found another unfortunate person who encountered the same problem, but never got a response:

    http://www.ActionScript.org/forums/showthread.php3?t=261853

    I've tried EVERYTHING. bitmapdatas loaded dynamically zippers are unmodifiable without apparent reason... unless the swf is opened in a trusted location or anywhere online.

    If you want your trusted local files, it adds trust files setting: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.htm l

  • How to query a Subvi dynamically loaded to its input terminals names?

    Hello

    I have an application where I use dynamically load the Subvi and I need a way to query the Subvi for its names of input terminals.  I'll use several different Subvi now and in the future and will not experience the terminals.

    Any help would be greatly appreciated.

    Thank you in advance!

  • Impossible to find dynamically loaded VI

    I am updating a code of LV6.1 to LV2011. The application works well before you build it and install it on another machine. When I install and run it on the other machine, it tries to open a file of reference, but it can not find a VI named DSA8300.vi. I get the following error message.

    Reference VI opened in InitScope.vi-> PATAR.vi->

    Path of the VI: c:\PATAR3.0.2\Range_RC3\Plugins\Scopes\DSA8300.vi<\b>

    Built Application or shared library (DLL): ensure that all loaded screws dynamically were correctly included in the specification for the application or a shared library build.

    But I checked the properties of my generation, and the file has been correctly included in the specifications of construction as a dynamic VI. What else can I check?

    Thank you very much.

    This thread can be useful.

    http://forums.NI.com/T5/LabVIEW/can-t-find-my-dynamically-loaded-VI-path/m-p/1124341/highlight/true#...

    Have you tried searching the forum for you the question?  There are others.

  • Return of dynamic loading vi loses focus

    Following the example of NI Loader.vi dynamic, my vi charge, runs and returns properly.  Howerver, when you use the same code to call from my main program, vi of the same load and runs, but in return, emphasis is not on the original vi.  A click of the mouse on the screen is necessary for the development of restoration.  Given that my program is heavilly keyboard based, it is a nuisance, and users may think that the program froze.

    Looking at the appearance of the window, showed that, in the Example.vi of dynamic load display front panel and narrow Panel have been verified.  These were not checked in my program.  When activated, this seemed to solve the problem.

    It seems that the first vi needs both to take focus on return of a vi loaded dynamically.

    Thanks for the tips.

  • Passing parameters to dynamically loaded screws

    Hello

    I have a data acquisition application that uses an analog input, PCI-Hardware.
    With this material I enjoy different channels and display them in audio
    In operation 'Preview' I enjoy 4 channels and display them in 4 audios.
    I have therefore a quarter of the maximum sampling for each channel.
    Operation 'zoom' I only enjoy a channel (at the material max sampling rate)
    and display the data in the selected channel (the other channels are igored in zoom mode)

    My idea is to launch the different screws according to the mode (overview, zooom).
    I could imagine, that a good approach to perfom this task calls different screws
    of the main program.

    Unfortunately, I do not understand how to pass parameters to the VI if I call them
    using knots "reference open VI", "call for reference" and "close reference VI.
    I tried to understand the Labview "Example of dynamic load", but it's too complicated for me.
    Can someone give me a simple example to dynamically load the screws or y at - it white papers
    or nugets on this topic?


  • How to debug several copies of a dynamically load vi

    I have a Subvi, which is dynamically load by several sie. How can I debug the Subvi for each instance? It seems that I can open only a copy of the Subvi but I want to get the front panel for each instance. Is this possible? Thank you!

    Tom

    You must do two things to open several instances of the same VI dynamically.

    • Make sure that the VI is reentrant.
    • Set the input options on Open VI refers to the value 8, indicating that you open the VI for reentrant run.

    In the case otherwise you simply open a reference to the same VI twice, and this instance cannot run in two places at the same time. The second call to the VI will have to wait for the first at the end.

  • App Builder with dynamically loaded VI - please help

    Hello

    Please take a look in the ZIP file attached with the sample project. The appellant load sub dynamically. This works well in the development environment (LV 2011) but when I build the EXE, it stops working. Please take a look; Ideally, repost fixed project in this thread, others to take advantage of the way to solve this problem...

    Thank you!

    JorgeinSD

    Hi Jorge,.

    This is the problem of the ususal: in the executable path to your dynamically loaded VI Exchange.

    You have defined to be included in the executable. If the path passes to Appdir\DynLoad.exe\LoadMeDynamically.vi, but you try to open the path AppDir\LoadMeDynamically.vi...

    Options:

    -check the execution (by the property node) environment to decide which way to use

    -change the location of the VI to "support the directory", this will be a folder named 'data' next to your executable file. Call the VI of this folder. You can do the same thing inside your project to have the same calling conventions in the development and runtime environment...

  • Dynamically loading the file location

    Hi all

    Please give me an idea on dynamic locations. At present iam using the localization file it works fine locally, but is new scenario: I need to download the file location on the server side and dynamically change the value.

    Please help me if anyone has any idea on this?

    Thank you

    I'm not saying it's impossible, but I really don't see a way to use the built-in location facility and have the ability to dynamically load the additional locations.

    My only suggestion is to establish a similar device yourself.

    If you are looking for something on the basis of this, in addition to the Blackberry application, I was looking at the Android application that uses XML "translation."  Using this approach, you would be able to download a new XML file to get a new translation.

  • dynamically load the Options in a drop-down list in C++

    Hey guys,.

    I'm trying to dynamically load items Option in a drop-down list by using C++.  I have a function in my class of WorkManager file that does the trick:

    QStringList WorkManager::getListOfItems() {
        int i = 0;
        QStringList taskNames;  // used for debugging mainly, so i can print the list out to debug
        QList  myObjects = m_model->toListOfObjects();
        DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild("scriptListDropDown");
        if (dpList != 0 ) {
            dpList->setSelectedOption(0);
            dpList->removeAll();
            for (i = 0; i < myObjects.size(); i++) {
                Task * myTask = (Task *) myObjects[i];
                taskNames.append(myTask->taskName());
                dpList->add(Option::create().text(myTask->taskName()).value(myTask->command()));
    //          delete myTask;  // do I need to delete the task object?
            }
    //      qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames;
            return taskNames;
        } else  {
            qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0";
            return taskNames;  // empty list
        }
    }
    

    I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.

    However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes.  calling the function above a second time anywhere in my application appears to hang the application immediately.

    I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.

    It seems down right when I do dpList-> removeAll().

    I also can't seem to find the right place to call this function to an object of type in my class.  I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:

    app->setScene(root);
    

    in the applicationui.cpp file.  Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.

    is there a better way to do it?  .. and make it safer?  I can't understand how to do this.

    Thank you!

    J

    First, drop the:

    dpList->setSelectedOption(0);
    

    Not only if it is not necessary, but it will explode your application if the function is called when there is already no options in the menu dropdown.

    Also, do NOT delete the task, because it is still owned by the datamodel. I also see that you use type casting C, which just blindly accepts your cast, even if it's a mistake. Instead, if you know for sure what kind it will be this way instead:

    Task* myTask = static_cast(myObjects[i]);
    

    If you are not sure if the type you are casting the is the type you need, use the dynamic_cast instead:

    Task* myTask = dynamic_cast(myObjects[i]);
    

    The advantage of this more static_cast , is that if you try to perform a type cast is not compatible, then myTask will be set to NULL.

    Alternatively, Qt offers a replacement for dynamic_cast which works on platforms where is not regular C++ casts.

    Task* myTask = qobject_cast(myObjects[i]);
    

    It is functionally equivalent to dynamic_cast, but as I said, it works on all platforms that Qt exists, whereas dynamic_cast cannot.

    Once you did get back to us.

    oddboy wrote:

    Hey guys,.

    I'm trying to dynamically load items Option in a drop-down list by using C++.  I have a function in my class of WorkManager file that does the trick:

    QStringList WorkManager::getListOfItems() {
        int i = 0;
        QStringList taskNames;  // used for debugging mainly, so i can print the list out to debug
        QList  myObjects = m_model->toListOfObjects();
        DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild("scriptListDropDown");
        if (dpList != 0 ) {
            dpList->setSelectedOption(0);
            dpList->removeAll();
            for (i = 0; i < myObjects.size(); i++) {
                Task * myTask = (Task *) myObjects[i];
                taskNames.append(myTask->taskName());
                dpList->add(Option::create().text(myTask->taskName()).value(myTask->command()));
    //          delete myTask;  // do I need to delete the task object?
            }
    //      qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames;
            return taskNames;
        } else  {
            qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0";
            return taskNames;  // empty list
        }
    }
    

    I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.

    However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes.  calling the function above a second time anywhere in my application appears to hang the application immediately.

    I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.

    It seems down right when I do dpList-> removeAll().

    I also can't seem to find the right place to call this function to an object of type in my class.  I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:

    app->setScene(root);
    

    in the applicationui.cpp file.  Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.

    is there a better way to do it?  .. and make it safer?  I can't understand how to do this.

    Thank you!

    J

  • How can I dynamically load swc files using as3? (without relying on the Flash IDE).

    How can I dynamically load swc files using as3? (without relying on the Flash IDE).

    The SWF file can be used in the same way as the CFC, which means that you don't need to "visually show" anything when it is loaded. Your code can use the classes and assets incorporated into the SWF, just as a SWC file. So if someone just to load the SWF file to see what was in it that they see nothing. They could however access programmatically to what anyone on the inside just like you, if they went to that level. But it is not as easy as just racing as SWF to see what is inside.

    I hope that all packaging several separate sovereigns will allow you to load and unload only what you need to keep the RAM usage as low as possible with a minimum load SWF.

    If you are ready, please mark all useful/correct so we can filter without response. You're welcome and good luck!

  • Dynamically load content in NavigatorContent inside Viewstack

    Thanks for help.

    Question:

    How do I dynamically load components or inside a NavigatorContent buttons when the user clicks on the

    Label NavigatorContent appropriate within the viewstack located inside the TabBar component?

    Code example...

    < s:Scroller id = "scrollerHome" includeIn = "Home" x = "3" y = "8" width = "933" height = "584" >

    < s:VGroup width = '100 percent"height ="100% ">

    < s:TabBar dataProvider = "{viewstackHome}" / >

    < mx:ViewStack id = "viewstackHome" width = '936' height = '553' >

    < s:NavigatorContent width = '100 percent"height ="100% "label ="Tab 1">

    .

    .

    .

    < / s:NAvigatorContent >

    < s:NavigatorContent width = '100 percent"height ="100% "label ="Tab 2">

    < / s:NavigatorContent >

    .

    .

    .

    < / mx:ViewStack >

    < / s:TabBar >

    < / s:VGroup >

    < / s:Scroller >

    When the user click on Tab1 or Tab2 depending on the time of day I want to

    display a different set of components which vary in number.

    Is there something that I need to manage, if so how. I could not find in these objects.

    Other suggestions are also welcome.

    Thank you

    Jumroo

    Since it's content browser, all components are created automatically the responsibility of the application that they do not obey the creationpolicy.

    1st way: I could intercept the events of "hide" / "show" on the content of navigator to listen to the event and dynamically add child elements.

    2nd way: Instead of Viewstack I'll go with the States of the spark.

    and on creationComplete of these components you can manage it that display and what not to do.

  • Dynamically loaded .jpg are pixelated

    I know that this subject has been discussed ad nauseum, but I tried to find and implement a solution without success.  For some reason some of the .jpgs on my flash site that are loaded dynamically load pixelated. I tried to find solutions to this, but I don't know exactly where a quality = better or smoothing = true script should be placed. And I'm just as puzzled as to why only some of my .jpgs load pixelated? It's very frustrating, this is the code I use to load my images, prental help:

    On the timeline, where the movieclip, I have the following code:

    loadMovie ("Wave.jpg", _root.image_box_9);


    On the movieclip itself, I have this code in order to create a fade chained in:


    {onClipEvent (load)}
    This ._alpha = 0;
    Speed = 10; change this option to change the speed of the fade
    }

    {onClipEvent (enterFrame)}
    load = this.getBytesLoaded()/this.getBytesTotal ();
    if(Loaded == 1) {}
    This ._alpha += speed;
    } else {}
    This ._alpha = 0;
    }
    If (this ._alpha > = 100) {}
    This ._alpha = 100;
    }
    }

    Could someone tell me please how to smooth this image? I would really appreciate it.

    in general, it is bad coding practice to fix the code to objects.  in your particular situation, it is really bad coding because this loop continues to run for as long as your movieclip exists.

    you have to attach code to a picture and put an end to this loop when it is no longer needed and you can use forceSmoothing to enable anti-aliasing.  Remove the code related to any object that you have demonstrated and replace your code with:

    _root.image_box_9.loadMovie ("Wave.jpg");

    _root.image_box_9._alpha = 0;
    _root.image_box_9.speed = 10;

    clearInterval (preloadI);
    preloadI = setInterval(preloadF,70);

    function preloadF (): Void {}
    If (_root.image_box_9.getBytesLoaded () > = () _root.image_box_9.getBytesTotal & _root.image_box_9.getBytesLoaded > 100) {}
    _root.image_box_9._alpha += _root.image_box_9.speed;
    _root.image_box_9.forceSmoothing = true;
    {if(_root.image_box_9._alpha>=100)}
    clearInterval (preloadI);
    }
    }
    }

  • text of dynamic loading problem

    Hi all

    I am trying to build a website and run into a problem with the dynamic loading of text.

    I'm doing a news section of scrolling with a scene of 200 W x 250 L

    Created a clip with the following encoding:


    var myTextLoader:URLLoader = new URLLoader();
    var myTextField_txt:TextField = new TextField();
    myTextField_txt.wordWrap = true;

    myTextLoader.addEventListener (Event.COMPLETE, onLoaded);

    function onLoaded(e:Event):void {}
    myTextField_txt.text = e.target.data;
    addChild (myTextField_txt);
    }

    myTextLoader.load (new URLRequest ("myText.txt"));

    Then set the clip (which is 250 w x 600 L) on the main stage, moving upward, creating the effect of auto-scroll.

    The problem that I am running is that I can't figure out how to put the text to use the entire width of the text box I created. It only uses half the width, by creating columbs like this:

    Hello and

    Welcome

    to our new

    Web site!

    Etc.etc.

    etc.etc.

    The text box itself is at least twice the width of the phrases, but they may not use the full width.

    Any ideas?

    I don't see where you set the size of the TextField.  Add a line to set the width to what he...

    myTextField_txt.width = 300; or any value that you are considering.

Maybe you are looking for

  • I dropped my old apple ID and cannot access the old ISP to retrieve the password.  How can I connect each device?

    I can not access my old password apple id and who cannot cross to change.  I use a 5 s Iphone.  Any suggestions?

  • Crash recovery system factory

    Hi guys,. I was doing a system recovery plant for about 2 hours. I have completed the formatting and reinstallation of recovery disks 1, 2, 3 and deleted records. The system continued to install packaged software and was nearly 95% through when it su

  • Camcorder Vixia HFm500, problems with playback.

    I have a camcorder Vixia HF M500.  I use a professional PNY 16 GB SDHC class 10 card.  When I try to access the AVCHD video I have on the card, via the play button, I get a yellow [?] instead of a thumbnail of the video on the map.  I went through th

  • VGA Driver for XP on presario CQ45 205AU

    Hello I have compaq presario CQ45 205AU, I bought BACK installed. I have a copy of XP and Windows 7 license. Windows 7 works very well with my laptop, but I have some software that does not work with Win 7, but were working on XP on my old system. So

  • Mr. Fix It download

    I get the following message when I try to download Mr. Fix It: An unexpected error has occurred.  Setup cannot continue.  Close, and then try again. Error: Configuration unexpected section system.serviceModel,(C:\\Windows\Microsoft.NET\Framework\v2.0